home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Utilities / MUIPictureCat / MUIPictureCatalog.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-26  |  92.9 KB  |  2,549 lines

  1. /*
  2. ** -----------------------------------------------
  3. **  $VER: MUIPictureCatalog V4.05 (26 May 2001)
  4. **  ©1996-2001 Michael Merkel
  5. ** -----------------------------------------------
  6. */
  7.  
  8. SIGNAL ON SYNTAX
  9. SIGNAL ON HALT
  10. SIGNAL ON BREAK_C
  11. OPTIONS RESULTS
  12.  
  13. /*
  14. TRACE ALL
  15. */
  16.  
  17. /*
  18. ** first of all add the needed libraries
  19. */
  20.  
  21. IF ~show("L","rmh.library")
  22. THEN IF ~AddLib("rmh.library", 0, -30) THEN EXIT
  23.  
  24. IF ~show("L","rxasl.library")
  25. THEN IF ~AddLib("rxasl.library", 0, -30) THEN EXIT
  26.  
  27. IF ~show("L","rxmui.library")
  28. THEN IF ~AddLib("rxmui.library", 0, -30) THEN EXIT
  29.  
  30. /*
  31. ** DEBUG MODE!!!
  32. */
  33.  
  34. Call rxMuiOpt("DEBUGMODE SHOWERR")
  35.  
  36. /*
  37. ** Make sure rexx support is opened
  38. */
  39. IF ~SHOW('L','rexxsupport.library')
  40. THEN CALL ADDLIB('rexxsupport.library',0,-30)
  41. IF ~SHOW('L','softlogik:libs/slarexxsupport.library')
  42. THEN CALL ADDLIB('softlogik:libs/slarexxsupport.library',0,-30)
  43.  
  44. IF ~SHOW('P','PAGESTREAM')
  45. THEN DO
  46.    CALL ShowRequester("Start PageStream first!", "Of course...")
  47.    Exit
  48. END
  49. ADDRESS 'PAGESTREAM'
  50.  
  51. pgsInstallDir  = 'PageStream:Scripts/MUIPictureCatalog'
  52. pgsName        = 'MUIPictureCatalog'
  53. pgsVersion     = 'V4.05'
  54. pgsAuthor      = 'Michael Merkel'
  55. pgsCopy        = '©1996-2001 Michael Merkel'
  56. pgsLVer        = '4.00'
  57. pgsDate        = '05/26/2001'
  58. pgsPic         = pgsInstallDir || '/MUIPictureCatalog.pic'
  59. standardPrefs  = pgsInstallDir || '/MUIPictureCatalog.prefs'
  60.  
  61. TRUE  = 1
  62. FALSE = 0
  63.  
  64. /*
  65. ** default settings
  66. */
  67. Call SetDefaultPrefs
  68.  
  69. /*
  70. ** do some checks before
  71. */
  72. Call CheckRoutines
  73.  
  74. /*
  75. ** load prefs
  76. */
  77. Call LoadPrefs(standardPrefs)
  78. Call BuildGUI
  79. muiBusyWinOpen = FALSE
  80.  
  81. /*
  82. ** open the window
  83. */
  84. 'LOCKINTERFACE TRUE'
  85. Call Set("muiWin", "OPEN", 1)
  86. Call GetAttr("muiWin", "OPEN", "o")
  87. IF (o = 0)
  88. THEN DO
  89.     Say "can't open window"
  90.     EXIT
  91. END
  92.  
  93. Call Set("muiWin", "SLEEP", 1)
  94. Call PrefsWindowSet()
  95. Call Set("muiWin", "SLEEP", 0)
  96. Call EventLoop()
  97. Call PrefsWindowGet()
  98. Call Set("muiWin", "OPEN", 0)
  99. Call BusyOpen("doing pictures...", 2, "...\n...", "...\n...", "", 100, 100, 0)
  100. Call PictureCatalog()
  101. Call CleanUp()
  102.  
  103. EXIT
  104.  
  105. /* /// AddPicture(name)
  106. */
  107. AddPicture:
  108.     PARSE ARG name
  109.  
  110.     DO WHILE (PlaceGraphic(name) > 0)
  111.         IF (lastpic = 1)
  112.         THEN DO    /* last picture placed on page */
  113.             Call BusyText(2, "%c%brefreshing display%n\n%c...%n")
  114.             Call BusyProgress(2, 100)
  115.  
  116.             'REFRESH CONTINUE'
  117. /*
  118.             'REFRESHWINDOW WINDOW "'oldwinname'"'
  119. */
  120.             IF (prefs.PV_action = 1) THEN CALL PrintPage
  121.             ELSE DO
  122.                 IF (prefs.PV_action = 2) THEN CALL SaveDocument
  123.                 'CURRENTWINDOWPATH'
  124.                 oldwinname = RESULT
  125.             END
  126.             pageNumber = pageNumber + 1
  127.             'DISPLAY PAGE 'pageNumber' WINDOW "'oldwinname'"'
  128.             nppp = 0
  129.             'REFRESH WAIT'
  130.         END
  131.     END
  132.     pNum = pNum + 1
  133. RETURN
  134. /* /// */
  135. /* /// BuildGUI()
  136. */
  137. BuildGUI:
  138.  
  139.     /*
  140.     ** Create the rxMUI GUI
  141.     ** --------------------
  142.     */
  143.  
  144.     /*
  145.     ** first of all the let's define the application object
  146.     */
  147.  
  148.     muiApp.Title       = pgsName
  149.     muiApp.Version     = "$VER: "|| pgsVersion ||' ('|| pgsDate ||')'
  150.     muiApp.Copyright   = pgsCopy
  151.     muiApp.Author      = pgsAuthor
  152.     muiApp.Description = "Create picture catalogs within PageStream"
  153.     muiApp.Base        = pgsName
  154.     muiApp.diskobject  = pgsName
  155.     muiApp.ctrlc       = 1
  156.     muiApp.menustrip   = "muiMenuStrip"
  157.     muiApp.subwindow   = "muiWin"
  158.  
  159.     /*
  160.     ** let's define the window
  161.     */
  162.     muiWin.ID       = "MAIN"
  163.     muiWin.Title    = pgsName pgsVersion ||' ('|| pgsDate ||') - '|| pgsCopy
  164.     muiWin.Contents = "muiMainGroup"
  165.  
  166.  
  167.     /*
  168.     ** define the menu
  169.     */
  170.     muiMenuStrip.0 = "muiMenuProject"
  171.         muiMenuProject.Title = "Project"
  172.         muiMenuProject.Class = "MENU"
  173.         muiMenuProject.0 = MenuItem("muiMenuAbout",     "About...",      "?")
  174.         muiMenuProject.1 = MenuItem("muiMenuAboutrxMUI","About RxMUI..."    )
  175.         muiMenuProject.2 = MenuItem("muiMenuAboutMUI",  "About MUI..."      )
  176.         muiMenuProject.3 = MenuItem("",                 "BAR"               )
  177.         muiMenuProject.4 = MenuItem("muiMenuQuit",      "Quit",          "Q")
  178.     muiMenuStrip.1 = "muiMenuPrefs"
  179.         muiMenuPrefs.Title = "Prefs"
  180.         muiMenuPrefs.Class = "MENU"
  181.         muiMenuPrefs.0 = MenuItem("muiMenuPrefsMUI",  "MUI...",          "M")
  182.         muiMenuPrefs.1 = MenuItem("",                  "BAR")
  183.         muiMenuPrefs.2 = MenuItem("muiMenuLoad",      "Load",          "L")
  184.         muiMenuPrefs.3 = MenuItem("muiMenuSave",      "Save",          "S")
  185.         muiMenuPrefs.4 = MenuItem("muiMenuSaveAs",      "Save As...",      "A")
  186.     res = NewObj("MENUSTRIP", "muiMenuStrip")
  187.     IF (res ~= 0)
  188.     THEN Call Err(res)
  189.  
  190.     /*
  191.     ** let's define the window contents
  192.     */
  193.  
  194.     tab = 0
  195.  
  196.     muiMainGroup.0            = "muiGroup0"
  197.         muiGroup0.Class            = "GROUP"
  198.         muiGroup0.Frame            = "GROUP"
  199.         muiGroup0.Horiz            = 0
  200.         muiGroup0.0                = "muiGroup00"
  201.             muiGroup00.Class        = "GROUP"
  202.             muiGroup00.Horiz        = 1
  203.             muiGroup00.Frame        = "GROUP"
  204.             muiGroup00.Background    = "FILLBACK"
  205.             muiGroup00.0            = HSpace()
  206.             muiGroup00.1            = "muiBITMAP"
  207.                 muiBITMAP.Class            = "BITMAP"
  208.                 muiBITMAP.Precision        = "ICON"
  209.                 muiBITMAP.File            = pgsPic
  210.                 muiBITMAP.InputMode        = "RelVerify"
  211.                 muiBITMAP.Frame            = "BUTTON"
  212.             muiGroup00.2            = Label(ParseText('%c%b%8'|| pgsName pgsVersion ||'%n\n'|| pgsCopy))
  213.             muiGroup00.3            = HSpace()
  214.         muiGroup0.1                = "muiGroupPage00"
  215.             muiGroupPage00.Class    = "GROUP"
  216.             muiGroupPage00.Horiz    = 1
  217.             muiGroupPage00.0        = "muiPagerList"
  218.                 muiPagerList.Class        = "NLISTVIEW"
  219.                 muiPagerList.List        = "pagerList"
  220.                 muiPagerList.Weight        = 20
  221.                     pagerList.Class            = "NLIST"
  222.                     pagerList.List            = "pagerList"
  223.                     pagerList.0             = "Page"
  224.                     pagerList.1                = "Thumbnails"
  225.                     pagerList.2                = "File settings"
  226.                     pagerList.3                = "Printer settings"
  227.                     pagerList.4                = "Types"
  228.          muiGroupPage00.1        = MakeObj(,"Balance",)
  229.             muiGroupPage00.2        = "muiPager"
  230.                 muiPager.Class            = "GROUP"
  231.                 muiPager.Weight            = 50
  232.                 muiPager.PageMode        = 1
  233.                 /*---------------------------------------------*/
  234.                 muiPager.tab                = "muiTabPage"; tab = tab + 1
  235.                     muiTabPage.Class             = "GROUP"
  236.                     muiTabPage.0                = VSpace()
  237.                     muiTabPage.1                = "muiTabPage0"
  238.                         muiTabPage0.Class            = "GROUP"
  239.                         muiTabPage0.Frame            = "GROUP"
  240.                         muiTabPage0.FrameTitle        = "PictureCatalog sizes"
  241.                         muiTabPage0.Background        = "BACKGROUND"
  242.                         muiTabPage0.Horiz            = 1
  243.                         muiTabPage0.0                = "muiTabPage00"
  244.                             muiTabPage00.Class            = "GROUP"
  245.                             muiTabPage00.Columns        = 4
  246.                             muiTabPage00.0                = Label("Top")
  247.                             muiTabPage00.1                = String("g_top")
  248.                             muiTabPage00.2                = Label("Left")
  249.                             muiTabPage00.3                = String("g_left")
  250.                             muiTabPage00.4                = Label("Bottom")
  251.                             muiTabPage00.5                = String("g_bottom")
  252.                             muiTabPage00.6                = Label("Right")
  253.                             muiTabPage00.7                = String("g_right")
  254.                         muiTabPage0.1                = Button("g_grabMP", "grab MP")
  255.                     muiTabPage.2                = VSpace(10)
  256.                     muiTabPage.3                = "muiTabPage1"
  257.                         muiTabPage1.Class            = "GROUP"
  258.                         muiTabPage1.Frame            = "GROUP"
  259.                         muiTabPage1.FrameTitle        = "Page"
  260.                         muiTabPage1.Background        = "BACKGROUND"
  261.                         muiTabPage1.Horiz            = 1
  262.                         muiTabPage1.0                = Label("page border width")
  263.                   muiTabPage1.1                = String("g_pbw")
  264.                         muiTabPage1.2                = Label("text size")
  265.                   muiTabPage1.3                = String("g_lsize")
  266.                     muiTabPage.4                = VSpace()
  267.                 /*---------------------------------------------*/
  268.                 muiPager.tab                = "muiTabThumb"; tab = tab + 1
  269.                     muiTabThumb.Class            = "GROUP"
  270.                     muiTabThumb.0                = "muiTabThumb0"
  271.                         muiTabThumb0.Class            = "GROUP"
  272.                         muiTabThumb0.Frame            = "GROUP"
  273.                         muiTabThumb0.FrameTitle        = "Thumbnail sizes"
  274.                         muiTabThumb0.Background        = "BACKGROUND"
  275.                         muiTabThumb0.0                = "G_SIZE"
  276.                             g_size.Class                   = "CYCLE"
  277.                             g_size.Entries                 = "variable size|fixed size"
  278.                             g_size.Selected                = 0
  279.                         muiTabThumb0.1                = "muiTabThumb00"
  280.                             muiTabThumb00.Class            = "GROUP"
  281.                             muiTabThumb00.Horiz            = 1
  282.                             muiTabThumb00.0                = "muiTabThumb000"
  283.                                 muiTabThumb000.Class        = "GROUP"
  284.                                 muiTabThumb000.0            = "muiTab0000T"
  285.                                     muiTab0000T.Class            = "TEXT"
  286.                                     muiTab0000T.Contents        = ParseText('%c%8number of pictures per page%n')
  287.                                 muiTabThumb000.1            = "muiTab00000"
  288.                                     muiTab00000.Class            = "GROUP"
  289.                                     muiTab00000.Columns            = 2
  290.                                     muiTab00000.0                = Label(ParseText('#x:'))
  291.                                     muiTab00000.1                = "G_X_NUM"
  292.                                         g_x_num.Class                = "SLIDER"
  293.                                         g_x_num.Min                    = 1
  294.                                         g_x_num.Max                    = 40
  295.                                         g_x_num.Level                = 1
  296.                                     muiTab00000.2                = Label(ParseText('#y:'))
  297.                                     muiTab00000.3                = "G_Y_NUM"
  298.                                         g_y_num.Class                = "SLIDER"
  299.                                         g_y_num.Min                    = 1
  300.                                         g_y_num.Max                    = 40
  301.                                         g_y_num.Level                = 1
  302.                             muiTabThumb00.1                = "muiTabThumb001"
  303.                                 muiTabThumb001.Class        = "GROUP"
  304.                                 muiTabThumb001.Disabled        = 1
  305.                                 muiTabThumb001.0            = "muiTabThumb001T"
  306.                                     muiTabThumb001T.Class        = "TEXT"
  307.                                     muiTabThumb001T.Contents    = ParseText('%c%8fixed size of one picture%n')
  308.                                 muiTabThumb001.1            = "muiTabThumb0010"
  309.                                     muiTabThumb0010.Class        = "GROUP"
  310.                                     muiTabThumb0010.Columns     = 2
  311.                                     muiTabThumb0010.0            = Label(ParseText('x size:'))
  312.                            muiTabThumb0010.1            = String("g_x_size")
  313.                                     muiTabThumb0010.2            = Label(ParseText('y size:'))
  314.                            muiTabThumb0010.3            = String("g_y_size")
  315.                         muiTabThumb0.2                = "muiTabThumb01"
  316.                             muiTabThumb01.Class            = "GROUP"
  317.                             muiTabThumb01.Horiz            = 1
  318.                             muiTabThumb01.0                = Checkmark(g_upscale)
  319.                             muiTabThumb01.1                = Label(ParseText('do not upscale'))
  320.                             muiTabThumb01.2                = HSpace()
  321.                         muiTabThumb0.3                = "muiTabThumb02"
  322.                             muiTabThumb02.Class            = "GROUP"
  323.                             muiTabThumb02.Horiz         = 1
  324.                             muiTabThumb02.0                = Checkmark(g_vertical)
  325.                             muiTabThumb02.1                = Label(ParseText('vertical mode'))
  326.                             muiTabThumb02.2                = HSpace()
  327.                         muiTabThumb0.4                = "muiTabThumb03"
  328.                             muiTabThumb03.Class            = "GROUP"
  329.                             muiTabThumb03.Horiz            = 1
  330.                             muiTabThumb03.0                = Label(ParseText('fpo for thumbnails'))
  331.                             muiTabThumb03.1                = "G_FPO"
  332.                                 g_fpo.Class                   = "CYCLE"
  333.                                 g_fpo.Entries                 = const.fpo.0 ||'|'|| const.fpo.1 ||'|'|| const.fpo.2 ||'|'|| const.fpo.3 ||'|'|| const.fpo.4
  334.                                 g_fpo.Selected                = 0
  335.                         muiTabThumb0.5                = "muiTabThumb04"
  336.                             muiTabThumb04.Class            = "GROUP"
  337.                             muiTabThumb04.Columns        = 2
  338.                             muiTabThumb04.0                = Label("custom FPO (dpi)")
  339.                             muiTabThumb04.1                = String("g_fpoCustom")
  340.                     muiTabThumb.1                 = VSpace(10)
  341.                     muiTabThumb.2                = "muiTabThumb3"
  342.                         muiTabThumb3.Class            = "GROUP"
  343.                         muiTabThumb3.Frame            = "GROUP"
  344.                         muiTabThumb3.FrameTitle        = "Thumbnail"
  345.                         muiTabThumb3.Background        = "BACKGROUND"
  346.                         muiTabThumb3.0                = "muiTabThumb30"
  347.                             muiTabThumb30.Class            = "GROUP"
  348.                             muiTabThumb30.Background    = "BACKGROUND"
  349.                             muiTabThumb30.0                = "muiTabThumb300"
  350.                                 muiTabThumb300.Class        = "GROUP"
  351.                                 muiTabThumb300.Columns        = 4
  352.                                 muiTabThumb300.0            = Label("border width")
  353.                                 muiTabThumb300.1            = String("g_sbw")
  354.                                 muiTabThumb300.2            = Label("inner space")
  355.                                 muiTabThumb300.3            = String("g_thumbSpace")
  356.                                 muiTabThumb300.4            = Label("gap")
  357.                                 muiTabThumb300.5            = String("g_gap")
  358.                                 muiTabThumb300.6            = Label("name size")
  359.                                 muiTabThumb300.7            = String("g_font")
  360.                             muiTabThumb30.1                = "muiTabThumb301"
  361.                                 muiTabThumb301.Class        = "GROUP"
  362.                                 muiTabThumb301.Frame        = "GROUP"
  363.                                 muiTabThumb301.FrameTitle    = "thumbnail text"
  364.                                 muiTabThumb301.0             = "g_thumbTextCycle"
  365.                                     g_thumbTextCycle.Class        = "CYCLE"
  366.                                     g_thumbTextCycle.Entries    = "%PICTURENAME/%PN - name|%PICTUREPATHFULL/%PPF - full path|%PICTUREPATHRELATIVE/%PPR - relative full path|%TYPE - picture type|%FACTOR - scale factor"
  367.                                 muiTabThumb301.1            = "g_thumbText"
  368.                                     g_thumbText.Class            = "TEXTINPUTSCROLL"
  369.                                     g_thumbText.Frame            = "STRING"
  370.                                     g_thumbText.MultiLine        = 1
  371.                                     g_thumbText.MaxLen            = 2
  372.                                     g_thumbText.MaxLines        = 2
  373.                                     g_thumbText.Lines            = 1
  374.                                     g_thumbText.Style            = "MUI"
  375.                                     g_thumbText.Contents        = ParseText("\%PICTURENAME\n[\%TYPE - \%SCALE]")
  376.                                     g_thumbText.Editable        = 1
  377.                 /*---------------------------------------------*/
  378.                 muiPager.tab            = "muiTabFile"; tab = tab + 1
  379.                     muiTabFile.Class        = "GROUP"
  380.                     muiTabFile.Columns        = 2
  381.                     muiTabFile.0            = HSpace(1)
  382.                     muiTabFile.1            = VSpace()
  383.                     muiTabFile.2            = Label("Directory to parse")
  384.                     muiTabFile.3            = "G_DIRASL"
  385.                         g_dirasl.Class           = "POPASL"
  386.                         g_dirasl.Type            = "FILE"
  387.                         g_dirasl.DrawersOnly    = 1
  388.                         g_dirasl.Title            = "picture directory..."
  389.                         g_dirasl.PositiveText    = "ok"
  390.                         g_dirasl.NegativeText    = "cancel"
  391.                         g_dirasl.RejectIcons    = 1
  392.                   g_dirasl.String            = String("g_dir")
  393.                     muiTabFile.4            = HSpace()
  394.                     muiTabFile.5            = "muiTC0"
  395.                         muiTC0.Class            = "GROUP"
  396.                         muiTC0.Horiz            = 1
  397.                         muiTC0.0                = Checkmark('g_rec',0)
  398.                         muiTC0.1                = Label("parse recursive")
  399.                         muiTC0.2                = HSpace()
  400.                     muiTabFile.6            = HSpace()
  401.                     muiTabFile.7            = "muiTC1"
  402.                         muiTC1.Class            = "GROUP"
  403.                         muiTC1.Columns            = 2
  404.                         muiTC1.0                = Label("directory pattern")
  405.                   muiTC1.1                = String("g_dirpattern")
  406.                         muiTC1.2                = Label("file pattern")
  407.                   muiTC1.3                = String("g_filepattern")
  408.                     muiTabFile.8            = HSpace(1)
  409.                     muiTabFile.9            = VSpace(5)
  410.                     muiTabFile.10            = Label("path for dumpfile")
  411.                     muiTabFile.11            = "G_DUMPASL"
  412.                         g_dumpasl.Class            = "POPASL"
  413.                         g_dumpasl.Type            = "FILE"
  414.                         g_dumpasl.Title            = "path for dumpfile..."
  415.                         g_dumpasl.PositiveText    = "ok"
  416.                         g_dumpasl.NegativeText    = "cancel"
  417.                         g_dumpasl.RejectIcons    = 1
  418.                   g_dumpasl.String        = String("g_dump")
  419.                     muiTabFile.12            = HSpace()
  420.                     muiTabFile.13            = "muiTC2"
  421.                         muiTC2.Class            = "GROUP"
  422.                         muiTC2.Horiz            = 1
  423.                         muiTC2.0                = Checkmark('g_skip',0)
  424.                         muiTC2.1                = Label("skip old pics")
  425.                         muiTC2.2                = HSpace()
  426.                     muiTabFile.14            = HSpace(1)
  427.                     muiTabFile.15            = VSpace(5)
  428.                     muiTabFile.16            = Label("filename for saving")
  429.                     muiTabFile.17            = "G_SDIRASL"
  430.                         g_sdirasl.Class           = "POPASL"
  431.                         g_sdirasl.Type            = "FILE"
  432.                         g_sdirasl.Title            = "save name..."
  433.                         g_sdirasl.PositiveText    = "ok"
  434.                         g_sdirasl.NegativeText    = "cancel"
  435.                         g_sdirasl.RejectIcons    = 1
  436.                   g_sdirasl.String        = String("g_sdir")
  437.                     muiTabFile.18            = HSpace(1)
  438.                     muiTabFile.19            = VSpace()
  439.                 /*---------------------------------------------*/
  440.                 muiPager.tab            = "muiTab2"; tab = tab + 1
  441.                     muiTab2.Class            = "GROUP"
  442.                     muiTab2.Columns            = 2
  443.                     muiTab2.0                = HSpace(1)
  444.                     muiTab2.1                = VSpace()
  445.                     muiTab2.2                = Label("print method")
  446.                     muiTab2.3                = "g_method"
  447.                         g_method.Class            = "CYCLE"
  448.                         g_method.Entries        = "greyscale|color"
  449.                         g_method.Selected        = 0
  450.                     muiTab2.4                = HSpace(1)
  451.                     muiTab2.5                = VSpace(5)
  452.                     muiTab2.6                = Label("print scale")
  453.                     muiTab2.7                = "g_scale"
  454.                         g_scale.Class            = "CYCLE"
  455.                         g_scale.Entries            = "actual size|scale to fit"
  456.                         g_scale.Selected        = 0
  457.                     muiTab2.8                = HSpace(1)
  458.                     muiTab2.9                = VSpace()
  459.                 /*---------------------------------------------*/
  460.                 muiPager.tab            = "muiTab3"; tab = tab + 1
  461.                     muiTab3.Class            = "GROUP"
  462.                     muiTab3.Columns            = 2
  463.                     muiTab3.0                = "muiTab3NL0"
  464.                         muiTab3NL0.Class        = "NLISTVIEW"
  465.                         muiTab3NL0.List            = "G_AVAIL"
  466.                             g_avail.Class            = "NLIST"
  467.                             g_avail.AdjustHeight    = 1
  468.                             g_avail.MultiSelect        = "DEFAULT"
  469.                             g_avail.Title            = ParseText('%cavailable types%n')
  470.                             g_avail.TitleClick        = 1
  471.                             g_avail.DragType        = "DEFAULT"
  472.                             g_avail.DragSortable    = 1
  473.                             g_avail.DragSortInsert    = 1
  474.                             g_avail.ShowDropMark    = 1
  475.                     muiTab3.1                = "muiTab3NL1"
  476.                         muiTab3NL1.Class        = "NLISTVIEW"
  477.                         muiTab3NL1.List            = "G_SELECT"
  478.                             g_select.Class            = "NLIST"
  479.                             g_select.AdjustHeight    = 1
  480.                             g_select.MultiSelect    = "DEFAULT"
  481.                             g_select.Title            = ParseText('%cselected types%n')
  482.                             g_select.TitleClick        = 1
  483.                             g_select.DragType        = "DEFAULT"
  484.                             g_select.DragSortable    = 1
  485.                             g_select.DragSortInsert    = 1
  486.                             g_select.ShowDropMark    = 1
  487.     muiMainGroup.1            = "G_ACTION"
  488.         g_action.Class           = "CYCLE"
  489.         g_action.ControlChar    = "a"
  490.         g_action.Entries         = "collect|print|save"
  491.         g_action.Selected        = 0
  492.     muiMainGroup.2            = "muiButtonGroup"
  493.         muiButtonGroup.Class    = "GROUP"
  494.         muiButtonGroup.Columns    = 2
  495.         muiButtonGroup.0        = Button("G_OK",     "_Ok"    )
  496.         muiButtonGroup.1        = Button("G_CANCEL", "_Cancel")
  497.  
  498.     /*
  499.     ** create all
  500.     */
  501.     Call NewObj("APPLICATION","muiApp")
  502.  
  503.     /*
  504.     ** window close gadget means quit...
  505.     */
  506.     Call Notify("muiWin", "CLOSEREQUEST", 1, "muiApp", "RETURNID", "QUIT")
  507.  
  508.     /*
  509.     ** Cycles
  510.     */
  511.     Call Notify("G_SIZE", "ACTIVE", 0, "muiTabThumb001", "SET", "DISABLED", 1)
  512.     Call Notify("G_SIZE", "ACTIVE", 0, "muiTabThumb000", "SET", "DISABLED", 0)
  513.     Call Notify("G_SIZE", "ACTIVE", 1, "muiTabThumb001", "SET", "DISABLED", 0)
  514.     Call Notify("G_SIZE", "ACTIVE", 1, "muiTabThumb000", "SET", "DISABLED", 1)
  515.  
  516.     Call Notify("G_FPO", "ACTIVE", 4, "G_FPOCUSTOM", "SET", "DISABLED", 0)
  517.     Call Notify("G_FPO", "ACTIVE", 0, "G_FPOCUSTOM", "SET", "DISABLED", 1)
  518.     Call Notify("G_FPO", "ACTIVE", 1, "G_FPOCUSTOM", "SET", "DISABLED", 1)
  519.     Call Notify("G_FPO", "ACTIVE", 2, "G_FPOCUSTOM", "SET", "DISABLED", 1)
  520.     Call Notify("G_FPO", "ACTIVE", 3, "G_FPOCUSTOM", "SET", "DISABLED", 1)
  521.     
  522.     /*
  523.     ** Ok and Cancel Buttons...
  524.     */
  525.     Call Notify("G_CANCEL", "PRESSED", 0, "muiApp", "RETURNID")
  526.     Call Notify("G_OK",     "PRESSED", 0, "muiApp", "RETURNID")
  527.     Call Notify("G_GRABMP", "PRESSED", 0, "muiApp", "RETURNID")
  528.  
  529.     /*
  530.     ** Menu events...
  531.     */
  532.     Call Notify("muiMenuLoad",        "MENUTRIGGER", "EVERYTIME", "muiApp", "RETURNID")
  533.     Call Notify("muiMenuSave",        "MENUTRIGGER", "EVERYTIME", "muiApp", "RETURNID")
  534.     Call Notify("muiMenuSaveAs",    "MENUTRIGGER", "EVERYTIME", "muiApp", "RETURNID")
  535.     Call Notify("muiMenuPrefsMUI",    "MENUTRIGGER", "EVERYTIME", "muiApp", "OpenConfigWindow")
  536.  
  537.     Call Notify("muiMenuAbout",            "MENUTRIGGER", "EVERYTIME", "muiApp", "ABOUT",      "muiWin")
  538.     Call Notify("muiMenuAboutrxMUI",    "MENUTRIGGER", "EVERYTIME", "muiApp", "ABOUTRXMUI", "muiWin")
  539.     Call Notify("muiMenuAboutMUI",        "MENUTRIGGER", "EVERYTIME", "muiApp", "ABOUTMUI",   "muiWin")
  540.     Call Notify("muiMenuQuit",            "MENUTRIGGER", "EVERYTIME", "muiApp", "RETURNID")
  541.  
  542.     /*
  543.     ** Button click -> about
  544.     */
  545.     Call Notify("muiBitmap", "PRESSED", 0, "muiApp", "ABOUT", "muiWin")
  546.  
  547.     Call DandD("g_select", "g_avail", "AUTO REMOVE")
  548.     Call DandD("g_avail",  "g_select", "AUTO REMOVE")
  549.     Call Notify("g_select", "titleclick", "everytime", "g_select", "sort2", "triggervalue", "add2values")
  550.     Call Notify("g_avail",  "titleclick", "everytime", "g_avail",  "sort2", "triggervalue", "add2values")
  551.  
  552.     Call Notify("muiPagerList", "ACTIVE", "EVERYTIME", "muiPager", "SET", "ACTIVEPAGE", "TRIGGERVALUE")
  553.  
  554.     /*
  555.     ** Set active gadget at start
  556.     */
  557.     Call Set("muiWin", "ActiveObject", "G_OK")
  558.     Call set("muiPagerList", "ACTIVE", 0)
  559.  
  560.     /*
  561.     ** Set all the Cycle chains (here, because it will not work above!)
  562.     */
  563.     Call Set("muiPagerList",    "CYCLECHAIN", 1)
  564.  
  565.     Call Set("g_top",            "CYCLECHAIN", 1)
  566.     Call Set("g_left",            "CYCLECHAIN", 1)
  567.     Call Set("g_bottom",        "CYCLECHAIN", 1)
  568.     Call Set("g_right",            "CYCLECHAIN", 1)
  569.     Call Set("g_grabMP",        "CYCLECHAIN", 1)
  570.     Call Set("g_pbw",            "CYCLECHAIN", 1)
  571.     Call Set("g_lsize",            "CYCLECHAIN", 1)
  572.     Call Set("g_sbw",            "CYCLECHAIN", 1)
  573.  
  574.     Call Set("g_size",                "CYCLECHAIN", 1)
  575.     Call Set("g_x_num",                "CYCLECHAIN", 1)
  576.     Call Set("g_y_num",                "CYCLECHAIN", 1)
  577.     Call Set("g_x_size",            "CYCLECHAIN", 1)
  578.     Call Set("g_y_size",            "CYCLECHAIN", 1)
  579.     Call Set("g_upscale",            "CYCLECHAIN", 1)
  580.     Call Set("g_vertical",            "CYCLECHAIN", 1)
  581.     Call Set("g_fpo",                "CYCLECHAIN", 1)
  582.     Call Set("g_fpoCustom",            "CYCLECHAIN", 1)
  583.     Call Set("g_thumbSpace",        "CYCLECHAIN", 1)
  584.     Call Set("g_gap",                "CYCLECHAIN", 1)
  585.     Call Set("g_font",                "CYCLECHAIN", 1)
  586.     Call Set("g_thumbtextcycle",    "CYCLECHAIN", 1)
  587.     Call Set("g_thumbtext",            "CYCLECHAIN", 1)
  588.  
  589.     Call Set("g_dir",                "CYCLECHAIN", 1)
  590.     Call Set("g_rec",                "CYCLECHAIN", 1)
  591.     Call Set("g_dirpattern",        "CYCLECHAIN", 1)
  592.     Call Set("g_filepattern",        "CYCLECHAIN", 1)
  593.     Call Set("g_dump",                "CYCLECHAIN", 1)
  594.     Call Set("g_skip",                "CYCLECHAIN", 1)
  595.     Call Set("g_sdir",                "CYCLECHAIN", 1)
  596.  
  597.     Call Set("g_method",            "CYCLECHAIN", 1)
  598.     Call Set("g_scale",                "CYCLECHAIN", 1)
  599.  
  600.     Call Set("g_avail",                "CYCLECHAIN", 1)
  601.     Call Set("g_select",            "CYCLECHAIN", 1)
  602.     Call Set("g_ok",                "CYCLECHAIN", 1)
  603.     Call Set("g_cancel",            "CYCLECHAIN", 1)
  604.     Call Set("g_action",            "CYCLECHAIN", 1)
  605.  
  606.     /*
  607.     ** Set all the short help texts
  608.     */
  609.     Call Set("g_top",                "SHORTHELP", ParseText("Top side of the page"))
  610.     Call Set("g_left",                "SHORTHELP", ParseText("Left side of the page"))
  611.     Call Set("g_right",                "SHORTHELP", ParseText("Right side of the page"))
  612.     Call Set("g_bottom",            "SHORTHELP", ParseText("Bottom side of the page"))
  613.     Call Set("g_grabMP",            "SHORTHELP", ParseText("Get sizes from current MasterPage"))
  614.     Call Set("g_pbw",                "SHORTHELP", ParseText("Weight of page border."))
  615.     Call Set("g_lsize",                "SHORTHELP", ParseText("Size for text on bottom of the page."))
  616.  
  617.     Call Set("g_size",                "SHORTHELP", ParseText("Select a maximum size for the thumbnails\nor the number per row/column"))
  618.     Call Set("g_x_num",                "SHORTHELP", ParseText("Number of thumbnails per row."))
  619.     Call Set("g_y_num",                "SHORTHELP", ParseText("Number of thumbnails per column."))
  620.     Call Set("g_x_size",            "SHORTHELP", ParseText("Maximum horizontal size of one thumbnail"))
  621.     Call Set("g_y_size",            "SHORTHELP", ParseText("Maximum vertical size of one thumbnail"))
  622.     Call Set("g_upscale",            "SHORTHELP", ParseText("Do not upscale smaller pictures"))
  623.     Call Set("g_vertical",            "SHORTHELP", ParseText("Place thumbnails vertically instead of horizontally"))
  624.     Call Set("g_fpo",                "SHORTHELP", ParseText("FPO resolution for the thumbnails"))
  625.     Call Set("g_sbw",                "SHORTHELP", ParseText("Weight of thumbnail border."))
  626.     Call Set("g_thumbSpace",        "SHORTHELP", ParseText("Space between thumbnails and thumbnailborder"))
  627.     Call Set("g_gap",                "SHORTHELP", ParseText("Gap between the thumbnails (horizontal AND vertical)."))
  628.     Call Set("g_font",                "SHORTHELP", ParseText("Size for the font names below the thumbnails.\nA textstyle called %bFontName%n will be used!"))
  629.     Call Set("g_thumbtextcycle",    "SHORTHELP", ParseText("All possible variables for the thumbnail text"))
  630.     Call Set("g_thumbtext",            "SHORTHELP", ParseText("Text for one thumbnail. Do NOT use quotes or special chars."))
  631.     
  632.     Call Set("g_dir",                "SHORTHELP", ParseText("Path to look for pictures"))
  633.     Call Set("g_rec",                "SHORTHELP", ParseText("search recursive?"))
  634.     Call Set("g_dirpattern",        "SHORTHELP", ParseText("Pattern for directories to search"))
  635.     Call Set("g_filepattern",        "SHORTHELP", ParseText("Pattern for files to search"))
  636.     Call Set("g_dump",                "SHORTHELP", ParseText("Path for the dumpfile"))
  637.     Call Set("g_skip",                "SHORTHELP", ParseText("Skip pictures already in the dumpfile?"))
  638.     Call Set("g_sdir",                "SHORTHELP", ParseText("Save file name when selected SAVE as action"))
  639.  
  640.     Call Set("g_method",            "SHORTHELP", ParseText("Print b/w or colored"))
  641.     Call Set("g_scale",                "SHORTHELP", ParseText("Scaled to fit or actual size output when selected PRINT"))
  642.  
  643.     Call Set("g_avail",                "SHORTHELP", ParseText("File types NOT used"))
  644.     Call Set("g_select",            "SHORTHELP", ParseText("File types used to search for pictures. (rom top to bottom)"))
  645.  
  646.     Call Set("g_action",            "SHORTHELP", ParseText("Collect, save or print the Catalog"))
  647.     Call Set("g_ok",                "SHORTHELP", ParseText("Start the Catalog generation"))
  648.     Call Set("g_cancel",            "SHORTHELP", ParseText("Leave program"))
  649.  
  650. Return
  651. /* /// */
  652. /* /// BusyClose()
  653. */
  654. BusyClose:
  655.    IF (muiBusyWinOpen = TRUE)
  656.    THEN DO
  657.       Call GetAttr("muiBusyWin", "OPEN", "o")
  658.       IF (o ~= 0)
  659.       THEN Call Set("muiBusyWin", "OPEN", 0)
  660.       Call Dispose("muiBusyWin")
  661.       muiBusyWinOpen = FALSE
  662.    END
  663. Return
  664. /* /// */
  665. /* /// BusyHandle(bAnz, current1, current2, current3)
  666. */
  667. BusyHandle: PROCEDURE
  668.     /*
  669.     ** Handle the mui busy window for font loading...
  670.     */
  671.     PARSE ARG bAnz,current1,current2,current3
  672.  
  673.     IF (bAnz >= 1) THEN Call GetAttr("muiBusyGauge1", "MAX", max1)
  674.     IF (bAnz >= 2) THEN Call GetAttr("muiBusyGauge2", "MAX", max2)
  675.     IF (bAnz >= 3) THEN Call GetAttr("muiBusyGauge3", "MAX", max3)
  676.  
  677.     IF ((bAnz >= 1) & (current1 >= 0)) THEN Call BusyProgress(1, current1)
  678.     IF ((bAnz >= 2) & (current2 >= 0)) THEN Call BusyProgress(2, current2)
  679.     IF ((bAnz >= 3) & (current3 >= 0)) THEN Call BusyProgress(3, current3)
  680.  
  681.     /*
  682.     ** this is the standard cycle to handle an application
  683.     */
  684.     ctrl_C = 2**12
  685.     s = 0
  686.     Call Handle("muiApp", "H", s)
  687.     DO i = 0 TO (H.num - 1)
  688.         id = H.i
  689.         SELECT
  690.             WHEN (id = "BUSY_CANCEL")
  691.             THEN DO
  692.                 userCancel = 1
  693.             END
  694.         END
  695.     END
  696.     s = Wait( OR(h.signals, ctrl_C) )
  697.     IF (AND(s, ctrl_C) ~= 0)
  698.     THEN userCancel = 1
  699. Return userCancel
  700. /* /// */
  701. /* /// BusyOpen(title, bAnz, text1, text2, text3, total1, total2, total3)
  702. */
  703. BusyOpen:
  704.     /*
  705.     ** Open a MUI busy requester with a maximum of 3 sliders (should be enough)
  706.     */
  707.     userCancel = 0
  708.     PARSE ARG title,bAnz,text1,text2,text3,total1,total2,total3
  709.  
  710.     /*
  711.     ** let's define the window
  712.     */
  713.  
  714.     muiBusyWin.ID          = "BUSY"
  715.     muiBusyWin.Title       = ParseText(title)
  716.     muiBusyWin.Contents    = "muiBusyGroup"
  717.     muiBusyWin.NoMenus     = 1
  718.  
  719.     /*
  720.     ** let's define the window contents
  721.     ** (simply 3 versions... how lazy!)
  722.     */
  723.  
  724.     muiBusyGroup.0 = "muiBusyGroup0"
  725.         muiBusyGroup0.Class         = "GROUP"
  726.         muiBusyGroup0.Frame         = "GROUP"
  727.         muiBusyGroup0.Horiz         = 0
  728.         muiBusyGroup0.0             = "muiBusyText1"
  729.             muiBusyText1.Class            = "TEXT"
  730.             muiBusyText1.Contents        = ParseText(text1)
  731.         muiBusyGroup0.1                = "muiBusyGauge1"
  732.             muiBusyGauge1.Class            = "GAUGE"
  733.             muiBusyGauge1.Frame            = "GAUGE"
  734.             muiBusyGauge1.Horiz            = 1
  735.             muiBusyGauge1.InfoText      = ""
  736.             muiBusyGauge1.Max           = total1
  737.             muiBusyGauge1.Current       = 0
  738.             muiBusyGauge1.FixHeightTxt     = 1
  739.     IF (bAnz >= 2)
  740.     THEN DO
  741.         muiBusyGroup0.2             = "muiBusyText2"
  742.             muiBusyText2.Class            = "TEXT"
  743.             muiBusyText2.Contents        = ParseText(text2)
  744.         muiBusyGroup0.3                = "muiBusyGauge2"
  745.             muiBusyGauge2.Class            = "GAUGE"
  746.             muiBusyGauge2.Frame            = "GAUGE"
  747.             muiBusyGauge2.Horiz            = 1
  748.             muiBusyGauge2.InfoText      = ""
  749.             muiBusyGauge2.Max           = total2
  750.             muiBusyGauge2.Current       = 0
  751.             muiBusyGauge2.FixHeightTxt     = 1
  752.     END
  753.     IF (bAnz = 3)
  754.     THEN DO
  755.         muiBusyGroup0.4             = "muiBusyText3"
  756.             muiBusyText3.Class            = "TEXT"
  757.             muiBusyText3.Contents        = ParseText(text3)
  758.         muiBusyGroup0.5                = "muiBusyGauge3"
  759.             muiBusyGauge3.Class            = "GAUGE"
  760.             muiBusyGauge3.Frame            = "GAUGE"
  761.             muiBusyGauge3.Horiz            = 1
  762.             muiBusyGauge3.InfoText      = ""
  763.             muiBusyGauge3.Max           = total3
  764.             muiBusyGauge3.Current       = 0
  765.             muiBusyGauge3.FixHeightTxt     = 1
  766.     END
  767.  
  768.     IF (bAnz = 1)
  769.     THEN DO
  770.         muiBusyGroup0.2               = HBar()
  771.         muiBusyGroup0.3               = Button("BUSY_CANCEL", "_Cancel")
  772.     END
  773.     ELSE IF (bAnz = 2)
  774.     THEN DO
  775.         muiBusyGroup0.4               = HBar()
  776.         muiBusyGroup0.5               = Button("BUSY_CANCEL", "_Cancel")
  777.     END
  778.     ELSE IF (bAnz = 3)
  779.     THEN DO
  780.         muiBusyGroup0.6               = HBar()
  781.         muiBusyGroup0.7               = Button("BUSY_CANCEL", "_Cancel")
  782.     END
  783.  
  784.     /*
  785.     ** Busy Cancel Button...
  786.     */
  787.     Call Notify("BUSY_CANCEL", "PRESSED", 0, "muiApp", "SETVAR", "userCancel")
  788.  
  789.     /*
  790.     ** generate new window object
  791.     */
  792.    res   = NewObj("WINDOW","muiBusyWin",,1)
  793.    IF (res ~= 0)
  794.    THEN Call err(res)
  795.    muiBusyWinOpen = TRUE
  796.  
  797.     /*
  798.     ** Set active gadget at start
  799.     */
  800.     Call Set("muiBusyWin", "ActiveObject", "BUSY_CANCEL")
  801.  
  802.     /*
  803.     ** to let the window be a bit larger....
  804.     */
  805.     Call Set("muiBusyGauge1", "INFOTEXT", ".............................................................................")
  806.  
  807.     /*
  808.     ** Add window to application
  809.     */
  810.     Call Add("muiApp", "muiBusyWin")
  811.  
  812.     Call Set("muiBusyWin", "OPEN", 1)
  813.     Call GetAttr("muiBusyWin", "OPEN", "o")
  814.     IF (o = 0)
  815.     THEN DO
  816.         Say "can't open busy window!"
  817.         Call ShowRequester("Can't open busy window! -> Exiting", "Sorry...")
  818.         Call CleanUp
  819.     END
  820. Return 1
  821. /* /// */
  822. /* /// BusyProgress(nr, current)
  823. */
  824. BusyProgress: PROCEDURE
  825.     /*
  826.     ** Set a new progress
  827.     */
  828.     PARSE ARG nr,current
  829.  
  830.     IF (nr = 1)
  831.     THEN DO
  832.         Call GetAttr("muiBusyGauge1", "MAX", max)
  833.         Call Set("muiBusyGauge1", "CURRENT", Trunc(current))
  834.         Call Set("muiBusyGauge1", "INFOTEXT", Trunc(100*current/max) ||"%")
  835.     END
  836.     ELSE IF (nr = 2)
  837.     THEN DO
  838.         Call GetAttr("muiBusyGauge2", "MAX", max)
  839.         Call Set("muiBusyGauge2", "CURRENT", Trunc(current))
  840.         Call Set("muiBusyGauge2", "INFOTEXT", Trunc(100*current/max) ||"%")
  841.     END
  842.     ELSE IF (nr = 3)
  843.     THEN DO
  844.         Call GetAttr("muiBusyGauge3", "MAX", max)
  845.         Call Set("muiBusyGauge3", "CURRENT", Trunc(current))
  846.         Call Set("muiBusyGauge3", "INFOTEXT", Trunc(100*current/max) ||"%")
  847.     END
  848. Return userCancel
  849. /* /// */
  850. /* /// BusyText(nr, text)
  851. */
  852. BusyText:
  853.     /*
  854.     ** Set a new text for one gauge in the busy requester
  855.     */
  856.     PARSE ARG nr,text
  857.  
  858.     IF (nr = 1) THEN Call Set("muiBusyText1", "CONTENTS", ParseText(text))
  859.     IF (nr = 2) THEN Call Set("muiBusyText2", "CONTENTS", ParseText(text))
  860.     IF (nr = 3) THEN Call Set("muiBusyText3", "CONTENTS", ParseText(text)
  861. Return
  862. /* /// */
  863. /* /// CheckPrefsVersion(fileName)
  864. */
  865. CheckPrefsVersion:
  866.     /*
  867.     ** Check if prefsfile is compatible
  868.     ** --------------------------------
  869.     */
  870.  
  871.     PARSE ARG fileName
  872.  
  873.     IF (fileName = "")
  874.     THEN fileName = standardPrefs
  875.  
  876.     ok = Open('Prefs', fileName, 'R')
  877.     IF (ok = 1)
  878.     THEN DO
  879.         dummy = ReadLn('Prefs')
  880.         cl = Close('Prefs')
  881.  
  882.         IF ( (Left(dummy, Length(pgsName)) = pgsName) | (Left(dummy, 3) = 'FSP') ) & (Right(dummy,4) >= pgsLVer)
  883.         THEN Return 0
  884.     END
  885. RETURN 1
  886. /* /// */
  887. /* /// CheckRoutines()
  888. */
  889. CheckRoutines:
  890.     ADDRESS "PAGESTREAM"
  891.  
  892.     'CURRENTWINDOWPATH'
  893.      oldWinName = RESULT
  894.  
  895.     'GETWINDOWPOS SIZE wp WINDOW "'oldWinName'"'
  896.     wPw = wp.w
  897.     wPh = wp.h
  898.     
  899.     'GETPAGEMASTERPAGE MASTERPAGE mname WINDOW "'oldwinname'"'
  900.     IF (RC = 10)
  901.     THEN DO
  902.         Call ShowRequester('Please open a new Document first.')
  903.         ADDRESS PAGESTREAM 'LOCKINTERFACE FALSE'
  904.         Call CleanUp()
  905.         EXIT
  906.     END
  907.  
  908.     'CURRENTPAGE WINDOW "'oldwinname'"'
  909.      pageNumber = RESULT
  910.  
  911.     IF ((pageNumber < 1) | (pageNumber > 999999))
  912.     THEN DO
  913.         /* maybe the user started from the masterpage?? */
  914.         Call ShowRequester('Please go to a valid page and start again!')
  915.         ADDRESS PAGESTREAM 'LOCKINTERFACE FALSE'
  916.         Call CleanUp()
  917.         EXIT
  918.     END
  919.  
  920. Return
  921. /* /// */
  922. /* /// CleanUp()
  923. */
  924. CleanUp:
  925.  
  926.     ADDRESS PAGESTREAM
  927.     /*
  928.     ** Close busy requester, clean up and leave program
  929.     ** ------------------------------------------------
  930.     */
  931.  
  932.    IF (muiBusyWinOpen = TRUE)
  933.    THEN DO
  934.       Call BusyClose()
  935.    END
  936.  
  937.     /*
  938.     ** reset the measurementsystem to the saved one!!
  939.     */
  940.     ''defmeasure''
  941.  
  942.     'REFRESH ON'
  943. /*
  944.     'REFRESHWINDOW WINDOW "'|| oldWinName ||'"'
  945. */
  946.     'LOCKINTERFACE FALSE'
  947. EXIT
  948. /* /// */
  949. /* /// ConvertText2hex(rawText)
  950. */
  951. ConvertText2hex:
  952.     PARSE ARG rawText
  953.  
  954.     rawHex  = c2x(rawText)
  955.     rawHex2 = ''
  956.     DO k = 1 TO Length(rawHex)
  957.         char = SubStr(rawHex, k, 2)
  958.         SELECT
  959.             /* line feed */
  960.             WHEN char = '0A'
  961.             THEN DO
  962.                 rawHex2 = rawHex2 || c2x('\n')
  963.             END
  964.             /* percent */
  965.             WHEN char = '25'
  966.             THEN DO
  967.                 rawHex2 = rawHex2 || c2x('\%')
  968.             END
  969.             OTHERWISE rawHex2 = rawHex2 || char
  970.         END
  971.         k = k + 1
  972.     END
  973. Return rawHex2
  974. /* /// */
  975. /* /// ConvertTextToMultipleLines(src)
  976. */
  977. ConvertTextToMultipleLines:
  978.     PARSE ARG src
  979.  
  980.     _num      = 1
  981.     _dest.num = _num
  982.     _dest.0   = src
  983.  
  984.     DO FOREVER
  985.         _prev = _num-1
  986.         pos = Index(_dest._prev, '\n')
  987.         IF (pos = 0)
  988.         THEN LEAVE
  989.  
  990.         _dest._num  = SubStr(_dest._prev, pos+2)
  991.         _dest._prev = Left(_dest._prev, pos-1)
  992.         _num = _num + 1
  993.     END
  994.     _dest.num = _num
  995. Return
  996. /* /// */
  997. /* /// ConvertToShortMeasurement(inp)
  998. */
  999. /*************************************************/
  1000. /* convert long measurement to short measurement */
  1001. /* (CENTIMETERS -> cm ...)                       */
  1002. /*************************************************/
  1003. ConvertToShortMeasurement:
  1004.     PARSE ARG inp
  1005.  
  1006.     long = 'INCHES CENTIMETERS MILLIMETERS PICAS POINTS PRINTERPICAS PRINTERPOINTS CICEROS DIDOTPOINTS FEET METERS'
  1007.     short = 'i cm mm p pt pp ppt c d f m'
  1008.  
  1009.     outp = ''
  1010.     DO k = 1 to Words(long)
  1011.  
  1012.         IF ( Word(long, k) = inp )
  1013.         THEN outp = Word(short, k)
  1014.     END
  1015.     IF (outp = '')
  1016.     THEN DO
  1017.         DO k = 1 to Words(long)
  1018.             IF (Word(long, k) = inp)
  1019.             THEN outp = Word(short, k)
  1020.         END
  1021.     END
  1022. Return outp
  1023. /* /// */
  1024. /* /// DrawPageBorder()
  1025. */
  1026. DrawPageBorder:
  1027.     'DISPLAY MPG RIGHT WINDOW "'oldwinname'"'
  1028.  
  1029.     d1 = prefs.leftGap + prefs.pageBorderWidth/2
  1030.     d2 = prefs.topGap +prefs.pageBorderWidth/2
  1031.     d3 = pagesizex-prefs.rightGap - prefs.pageBorderWidth/2
  1032.     d4 = pagesizey-prefs.bottomGap - prefs.pageBorderWidth/2 - (prefs.lSize+1)
  1033.  
  1034.     'DRAWBOX 'd1 d2 d3 d4' WINDOW "'oldwinname'"'
  1035.      dummy = RESULT
  1036.     'SETSTROKEWEIGHT 'prefs.pageBorderWidth' OBJECTID 'dummy
  1037.     'SETSTROKEJOIN ROUND OBJECTID 'dummy
  1038.  
  1039.     IF (prefs.lSize > 0)
  1040.     THEN DO
  1041.         d1 = d1 - prefs.pageBorderWidth/2
  1042.         d3 = d3 + prefs.pageBorderWidth/2
  1043.         d4 = d4 + prefs.pageBorderWidth/2 + 1
  1044.         'DRAWTEXTOBJ 'd1 d4' INFRONT WINDOW "'oldwinname'"'
  1045.         txtid = RESULT
  1046.         'SELECTTEXT INOBJECT '|| txtid ||' REPLACE WINDOW "'oldwinname'"'
  1047.  
  1048.         bottomtwidth = d3 - d1
  1049.  
  1050.         'BEGINCOMMANDCAPTURE'
  1051.          'SETTRACKTABLE NONE'
  1052.          'SETLEADING RELATIVE 100%'
  1053.          'SETTYPESIZE "'prefs.lSize'"'
  1054.         'ENDCOMMANDCAPTURE'
  1055.  
  1056.         'INSERT "'||pgsName pgsVersion||' - '||pgsCopy||'" WINDOW "'oldwinname'"'
  1057.         'SETTABRULER "RIGHT" 'bottomtwidth' WINDOW "'oldwinname'"'
  1058.         'INSERTCONTROL TAB WINDOW "'oldwinname'"'
  1059.         'INSERT "Page " WINDOW "'oldwinname'"'
  1060.         'INSERTNUMBER PAGE WINDOW "'oldwinname'"'
  1061.     END
  1062.     'DISPLAY PAGE 'pagenumber' WINDOW "'oldwinname'"'
  1063. RETURN
  1064. /* /// */
  1065. /* /// DumpText(dumptxt)
  1066. */
  1067. DumpText:
  1068.     PARSE ARG dumptxt
  1069.  
  1070.     commands = prefs.PV_dump'PicCatalog.dumpfile'
  1071.     IF (Open('dump' ,commands, 'A') = 1)
  1072.     THEN DO
  1073.       wl = WriteLN('dump',dumptxt)
  1074.       cl = Close('dump')
  1075.     END
  1076. RETURN
  1077. /* /// */
  1078. /* /// err(res)
  1079. */
  1080. err:
  1081.     PARSE ARG res
  1082.  
  1083.     ADDRESS 'PAGESTREAM'
  1084.     'LOCKINTERFACE FALSE'
  1085.     'REFRESH ON'
  1086.     'REFRESHWINDOW WINDOW "'|| oldWinName ||'"'
  1087.     ''defmeasure''
  1088.     Call pgsRequester(GetRXmuiString(res) "in line" sigl-1)
  1089. Exit
  1090. /* /// */
  1091. /* /// EventLoop()
  1092. */
  1093. EventLoop:
  1094.     /*
  1095.     ** this is the standard cycle to handle an application
  1096.     */
  1097.     ctrl_C = 2**12
  1098.     s = 0
  1099.     DO FOREVER
  1100.         Call Handle("muiApp", "H", s) /* THIS IS LINE prefs.rxMUI_LINE_1 = 954 */
  1101.         ws = 0
  1102.         DO i = 0 TO (H.num - 1)
  1103.             id = H.i
  1104.             SELECT
  1105.                 WHEN (id = "QUIT") | (id = "G_CANCEL")
  1106.                 THEN DO
  1107.                     Call CleanUp
  1108.                     EXIT
  1109.                 END
  1110.  
  1111.                 WHEN (id = "G_GRABMP")
  1112.                 THEN DO
  1113.                     Call PrefsWindowGet()
  1114.                     Call GrabMasterPage()
  1115.                     Call PrefsWindowSet()
  1116.                 END
  1117.  
  1118.             WHEN (id = "MUIMENUPREFSMUI")
  1119.                 THEN DO
  1120.                 END
  1121.  
  1122.                 WHEN (id = "MUIMENULOAD")
  1123.                 THEN DO
  1124.                     Call LoadPrefsAs()
  1125.                     Call PrefsWindowSet()
  1126.                 END
  1127.  
  1128.                 WHEN (id = "MUIMENUSAVE")
  1129.                 THEN DO
  1130.                     Call PrefsWindowGet()
  1131.                     Call SavePrefs()
  1132.                     Call PrefsWindowSet()
  1133.                 END
  1134.  
  1135.                 WHEN (id = "MUIMENUSAVEAS")
  1136.                 THEN DO
  1137.                     Call PrefsWindowGet()
  1138.                     Call SavePrefsAs()
  1139.                     Call PrefsWindowSet()
  1140.                 END
  1141.  
  1142.                 WHEN (id = "MUIMENUQUIT")
  1143.                 THEN DO
  1144.                     IF (ShowRequester('Really Quit?', 'No|Yes') = 0)
  1145.                     THEN DO
  1146.                         Call CleanUp
  1147.                         EXIT
  1148.                     END
  1149.                 END
  1150.  
  1151.                 WHEN (id = "G_OK")
  1152.                 THEN DO
  1153.                     Return
  1154.                 END
  1155.  
  1156.                 OTHERWISE Say h.i
  1157.             END
  1158.         END
  1159.         IF (~ws) THEN Iterate
  1160.         s = Wait( OR(h.signals, ctrl_C) )
  1161.         IF (AND(s, ctrl_C) ~= 0)
  1162.         THEN EXIT
  1163.     END
  1164. EXIT
  1165. /* /// */
  1166. /* /// FormatListsInitialize()
  1167. */
  1168. FormatListsInitialize:
  1169.     /*
  1170.     ** initialize the available list
  1171.     */
  1172.     Call DoMethod("G_AVAIL",  "CLEAR")
  1173.     Call DoMethod("G_SELECT", "CLEAR")
  1174.  
  1175.     DO k=1 TO WORDS(prefs.PV_formats)
  1176.       DO r=1 TO WORDS(const.formats)
  1177.             /*
  1178.             ** only append entries which are available!
  1179.             */
  1180.          IF WORD(const.formats,r ) = WORD(prefs.PV_formats, k)
  1181.             THEN DO
  1182.                 Call DoMethod("G_SELECT", "INSERT", WORD(prefs.PV_formats, k), "BOTTOM")
  1183.             r = WORDS(const.formats) + 1
  1184.             END
  1185.         END
  1186.     END
  1187.  
  1188.    DO k=1 TO WORDS(const.formats)
  1189.         found = 0
  1190.         DO r=1 TO WORDS(prefs.PV_formats)
  1191.             /*
  1192.             ** only append entries which are NOT selected!
  1193.             */
  1194.          IF WORD(const.formats, k) = WORD(prefs.PV_formats, r) THEN found = 1
  1195.         END
  1196.         IF (found = 0)
  1197.         THEN DO
  1198.          Call DoMethod("G_AVAIL", "INSERT", WORD(const.formats, k), "BOTTOM")
  1199.         END
  1200.     END
  1201.  
  1202. Return
  1203. /* /// */
  1204. /* /// GetDefaultMeasurementSystem()
  1205. */
  1206. GetDefaultMeasurementSystem:
  1207.     PROCEDURE
  1208.  
  1209.     'GETMEASUREMENTS COORDINATE stemc RELATIVE rel TEXT tex FROM fro'
  1210.      st = 'SETMEASUREMENTS COORDINATE 'stemc.horizontal stemc.vertical' RELATIVE 'rel' TEXT 'tex' FROM 'fro
  1211.     'SETMEASUREMENTS COORDINATE POINTS SAMEAS RELATIVE SAMEAS TEXT POINTS FROM PAGE'
  1212. Return st
  1213. /* /// */
  1214. /* /// GetFileName(prefName)
  1215. */
  1216. GetFileName:
  1217.     PARSE ARG fileName,text
  1218.     file = FilePart(fileName)
  1219.     path = PathPart(fileName)
  1220.  
  1221.     'GETFILE TITLE "'|| text ||'" PATH "'|| path ||'" FILE "'|| file ||'"'
  1222.     IF (RC = 0)
  1223.     THEN fileName = RESULT
  1224.     ELSE fileName = 0
  1225. Return fileName
  1226. /* /// */
  1227. /* /// GetLength(fileName)
  1228. */
  1229. GetLength:
  1230.     PROCEDURE EXPOSE BusyReq
  1231.     PARSE ARG filename
  1232.  
  1233.     ADDRESS COMMAND 'C:List 'filename' LFORMAT="%l" >T:PicCatalogLength.tmp'
  1234.     IF (Open('flength','T:PicCatalogLength.tmp','R') = 1)
  1235.     THEN DO
  1236.         l = ReadLN('flength')
  1237.         cl = Close('flength')
  1238.         ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalogLength.tmp QUIET'
  1239.  
  1240.         IF (compare(l,'empty') = 0)
  1241.         THEN return 0
  1242.         ELSE return l
  1243.     END
  1244.     ELSE return 0
  1245. RETURN ll
  1246. /* /// */
  1247. /* /// GrabMasterPage()
  1248. */
  1249. GrabMasterPage:
  1250.     ADDRESS 'PAGESTREAM'
  1251.  
  1252.     'GETPAGEMASTERPAGE MASTERPAGE mname'
  1253.     IF (RC = 10)
  1254.     THEN DO
  1255.         Call ShowRequester('Please open a new Document first! Quit now!')
  1256.         Return
  1257.     END
  1258.  
  1259.     'GETMEASUREMENTS COORDINATE stemc'
  1260.  
  1261.     IF (stemc.vertical = 'SAMEAS')
  1262.     THEN stemc.vertical = stemc.horizontal
  1263.  
  1264.     'GETMARGINGUIDES guides'
  1265.  
  1266.     prefs.PV_left   = guides.inside  || ConvertToShortMeasurement(stemc.horizontal)
  1267.     prefs.PV_right  = guides.outside || ConvertToShortMeasurement(stemc.horizontal)
  1268.     prefs.PV_top    = guides.top     || ConvertToShortMeasurement(stemc.vertical)
  1269.     prefs.PV_bottom = guides.bottom  || ConvertToShortMeasurement(stemc.vertical)
  1270. Return
  1271. /* /// */
  1272. /* /// LoadPrefs(fileName)
  1273. */
  1274. LoadPrefs:
  1275.  
  1276.     /*
  1277.     ** load the preferences file
  1278.     ** -------------------------
  1279.     */
  1280.  
  1281.     PARSE ARG fileName
  1282.     IF (fileName = "")
  1283.     THEN fileName = standardPrefs
  1284.  
  1285.     say 'loading 'fileName' ...'
  1286.  
  1287.     /*
  1288.     ** Check the version of the prefs file
  1289.     */
  1290.  
  1291.     IF (CheckPrefsVersion(fileName) ~= 0)
  1292.     THEN DO
  1293.         Call ShowRequester('Prefsfile not found or not valid! Using defaults.', 'Hmm...')
  1294.         Return
  1295.     END
  1296.     ELSE DO
  1297.         Call Open('Prefs', fileName, 'R')
  1298.         Say 'Reading prefs file...'
  1299.         dummy = ReadLN('Prefs')
  1300.         DO xx = 1 to 100
  1301.             command = ReadLn('Prefs')
  1302.             INTERPRET command
  1303.             IF EOF('Prefs') THEN LEAVE
  1304.         END
  1305.         Call Close('Prefs')
  1306.     END
  1307. RETURN
  1308. /* /// */
  1309. /* /// LoadPrefsAs()
  1310. */
  1311. LoadPrefsAs:
  1312.     /*
  1313.     ** Load Prefs with selectable name
  1314.     ** -------------------------------
  1315.     */
  1316.  
  1317.     prefName = GetFileName(currentPrefs, 'Load Preferences...')
  1318.     IF (prefName ~= 0)
  1319.     THEN DO
  1320.         currentPrefs = prefName
  1321.         Call LoadPrefs(currentPrefs)
  1322.     END
  1323. Return
  1324. /* /// */
  1325. /* /// pgsRequester(text)
  1326. */
  1327. pgsRequester:
  1328.     PARSE ARG meldung
  1329.  
  1330.     /*
  1331.     ** Convert to multiple lines
  1332.     */
  1333.  
  1334.     _num       = 1
  1335.     mLines.num = _num
  1336.     mLines.0   = meldung
  1337.  
  1338.     DO FOREVER
  1339.         _prev = _num-1
  1340.         pos = Index(mLines._prev, '|')
  1341.         IF (pos = 0)
  1342.         THEN LEAVE
  1343.  
  1344.         mLines._num  = SubStr(mLines._prev, pos+1)
  1345.         mLines._prev = Left(mLines._prev, pos-1)
  1346.         _num = _num + 1
  1347.     END
  1348.     mLines.num = _num
  1349.  
  1350.     l = 0
  1351.     DO kk = 0 TO mLines.num - 1
  1352.         IF (l < Length(mLines.kk) * 8)
  1353.         THEN l = Length(mLines.kk) * 8
  1354.         Say mLines.kk
  1355.     END
  1356.  
  1357.     ADDRESS "PAGESTREAM"
  1358.     'ALLOCAREXXREQUESTER "error inside '|| pgsName ||'" '|| (l+20) (40 + mLines.num * 10)
  1359.      reqhandle = RESULT
  1360.  
  1361.     'ADDAREXXGADGET '|| reqhandle ||' EXIT '|| (l/2 - 25) (20 + mLines.num * 10) ||' 50 LABEL "_Ok"'
  1362.      dummy = RESULT
  1363.  
  1364.     DO kk = 0 TO mLines.num - 1
  1365.         'ADDAREXXGADGET 'reqhandle' TEXT 10 ' (10 + kk*10) l 'STRING "'mLines.kk'"'
  1366.     END
  1367.  
  1368.     'DOAREXXREQUESTER 'reqhandle
  1369.      dummy = RESULT
  1370.  
  1371.     'FREEAREXXREQUESTER 'reqhandle
  1372. RETURN
  1373. /* /// */
  1374. /* /// PlaceGraphic(name)
  1375. */
  1376. PlaceGraphic:
  1377.     PARSE ARG name
  1378.  
  1379.     Call BusyText(1, "%c%bplacing picture%n\n%c"|| name ||"%n")
  1380.     Call BusyText(2, "%c%bloading...%n\n%c%n")
  1381.     Call BusyProgress(2, 30)
  1382.     IF (BusyHandle(1, 0, 0, 0) = 1)
  1383.     THEN DO
  1384.         Call CleanUp()
  1385.         EXIT
  1386.     END
  1387.  
  1388.     /*
  1389.     ** this prevents ARexx to show error messages (RC=10) if pictype is wrong
  1390.     */
  1391.     OPTIONS FAILAT 11
  1392.  
  1393.     pictypetext = ''
  1394.     pictype     = 0
  1395.     fileget     = 0
  1396.     document3     = 0
  1397.  
  1398.     /* ----------------------------------------------------------------- pgs3 documents! */
  1399.     DO fk = 1 TO WORDS(prefs.PV_formats)
  1400.         IF (WORD(prefs.PV_formats, fk) = 'PAGESTREAM3DOC')
  1401.         THEN pgsdoc = 1
  1402.         ELSE pgsdoc = 0
  1403.     END
  1404.  
  1405.     IF (pgsdoc = 1)
  1406.     THEN DO
  1407.         'OPENDOCUMENT FILE "'name'" FILTER "IFFDOC"'
  1408.         IF (RC = 0)
  1409.         THEN DO
  1410.             wpw2 = wpw/2
  1411.             wph2 = wph/2
  1412.             'SETWINDOWDEFAULTS SIZE 'wpw2 wph2
  1413.             'REFRESH CONTINUE'
  1414.             'OPENWINDOW "PICdumm" PAGE 1 SCALE "50%"'
  1415.  
  1416.             'REFRESH WAIT'
  1417.             'SETWINDOWDEFAULTS SIZE 'wpw wph
  1418.  
  1419.             'GETPAGEMASTERPAGE MASTERPAGE mname2 DEPTH mwhere2 WINDOW "PICdumm"'
  1420.             mdisplayed = RESULT
  1421.  
  1422.             'GETDIMENSIONS dim2 MASTERPAGE "'mname2'"'
  1423.             IF (dim2.orientation = 'PORTRAIT')
  1424.             THEN DO
  1425.                 px2 = dim2.width
  1426.                 py2 = dim2.height
  1427.             END
  1428.             ELSE DO
  1429.                 px2 = dim2.height
  1430.                 py2 = dim2.width
  1431.             END
  1432.  
  1433.             IF (mdisplayed = 'ON')   /* document has a masterpage which is displayed ... */
  1434.             THEN DO
  1435.                 'DISPLAY MPG "'|| mname2 ||':RIGHT" SCALE "10%" WINDOW "PICdumm"'
  1436.                 'SELECTOBJECT ALL WINDOW "PICdumm"'
  1437.                 'UNLOCK WINDOW "PICdumm"'
  1438.                 'TRANSFORM 1 WINDOW "PICdumm"'
  1439.                 'MOVETOPAGE PAGE 1 WINDOW "PICdumm"'
  1440.                 'DISPLAY PAGE 1 SCALE "10%" WINDOW "PICdumm"'
  1441.                 IF (mwhere2 = 'INBACK') THEN 'SENDTOBACK WINDOW "PICdumm"'    /* ... in back */
  1442.                 ELSE                         'SENDTOFRONT WINDOW "PICdumm"'   /* ... in front */
  1443.             END
  1444.             'DRAWBOX 0 0 'px2 py2' WINDOW "PICdumm"'
  1445.             'SELECTOBJECT ALL WINDOW "PICdumm"'
  1446.             'UNLOCK WINDOW "PICdumm"'
  1447.             'CREATEDRAWING BEST WINDOW "PICdumm"'
  1448.             'COPYOBJECT WINDOW "PICdumm"'
  1449.  
  1450.             'CLOSEDOCUMENT FORCE WINDOW "PICdumm"'
  1451.             'REVEALWINDOW WINDOW "'oldwinname'"'
  1452.  
  1453.             'PASTEOBJECT WINDOW "'oldwinname'"'
  1454.             picid = RESULT
  1455.             fileget = 1
  1456.             document3 = 1
  1457.             pictypetext = 'PGS3DOC'
  1458.         END
  1459.     END
  1460. /* ----------------------------------------------------------------- bitmaps! */
  1461.  
  1462.     IF fileget = 0
  1463.     THEN DO
  1464.         DO fk = 1 TO WORDS(prefs.PV_formats)
  1465.             IF (WORD(prefs.PV_formats, fk) ~= 'PAGESTREAM3DOC')
  1466.             THEN DO
  1467. /**/
  1468.                 'PLACEGRAPHIC FILE "'name'" FILTER "'WORD(prefs.PV_formats, fk)'" NOSTATUS WINDOW "'oldwinname'"'
  1469. /**/
  1470. /*
  1471.                 'DRAWPICTURE CONTENTOFFSET 0 0 FRAMED FILE "'name'" STORED "EXTERNAL" FPO "'|| const.fpo._pvfpo ||'" WINDOW "'oldwinname'"'
  1472. */
  1473.                 IF (RC = 0)
  1474.                 THEN DO
  1475.                     fileget = 1
  1476.                     pictypetext = WORD(prefs.PV_formats, fk)
  1477.                     LEAVE
  1478.                 END
  1479.             END
  1480.         END
  1481.     END
  1482.  
  1483. /* ------------------------------------------------------------- endfiletypes */
  1484.  
  1485.     OPTIONS FAILAT 10
  1486.  
  1487.     IF (fileget = 1)
  1488.     THEN DO
  1489.         /*
  1490.         ** remember FPO settings
  1491.         */
  1492.         _pvfpo = prefs.PV_fpo
  1493.         FPO_String = const.fpo._pvfpo
  1494.         IF FPO_String = 'CUSTOM'
  1495.         THEN FPO_String = FPO_String ||' '|| prefs.PV_fpoCustom ||' '|| prefs.PV_fpoCustom
  1496.         Call BusyText(2, "%c%bplacing...%n\n%c%n")
  1497.         Call BusyProgress(2, 60)
  1498.         'GETOBJECT TYPE objtype WINDOW "'oldwinname'"'
  1499.         SELECT
  1500.             WHEN (objtype = 2 ) THEN pictype = 2
  1501.             WHEN (objtype = 12) THEN pictype = 1
  1502.             WHEN (objtype = 13) THEN pictype = 3
  1503.         END
  1504.         SELECT
  1505.             WHEN (pictype = 1) THEN 'GETPICTURE POSITION posi WINDOW "'oldwinname'"'
  1506.             WHEN (pictype = 2) THEN 'GETDRAWING POSITION posi WINDOW "'oldwinname'"'
  1507.             WHEN (pictype = 3) THEN 'GETEPS POSITION posi WINDOW "'oldwinname'"'
  1508.         END
  1509.         picid = RESULT
  1510.  
  1511.         d1 = startx
  1512.         d2 = starty
  1513.         oldStartx = startx
  1514.         oldStarty = starty
  1515.  
  1516.         pwidth     = posi.right - posi.left
  1517.         pheight = posi.bottom - posi.top
  1518.         
  1519.         IF (prefs.PV_size = 0)
  1520.         THEN DO
  1521.             gsf = pwidth / pheight
  1522.             IF (gsf > psf0)
  1523.             THEN factor = (psx0   - 2*(prefs.sampleBorderWidth + prefs.thumbSpace)) / pwidth
  1524.             ELSE factor = (psy0nt - 2*(prefs.sampleBorderWidth + prefs.thumbSpace)) / pheight
  1525.  
  1526.             IF (prefs.PV_upscale = 1)
  1527.             THEN IF (factor > 1) THEN factor = 1
  1528.  
  1529.             newpwidth  = (factor * pwidth)
  1530.             newpheight = (factor * pheight)
  1531.  
  1532.             centerdeltax = (psx0   - newpwidth)  / 2
  1533.             centerdeltay = (psy0nt - newpheight) / 2
  1534.  
  1535.             d3 = d1 + psx0
  1536.             d4 = d2 + psy0
  1537.  
  1538.             IF (prefs.PV_vertical = 0)
  1539.             THEN DO
  1540.                 /*
  1541.                 ** vertical mode is off:
  1542.                 ** 1. check if too far right -> next row
  1543.                 */
  1544.                 IF ((d3 - 1) > (pagesizex - prefs.rightGap - prefs.pageBorderWidth - prefs.gap))
  1545.                 THEN DO
  1546.                     startx = prefs.leftGap + prefs.pageBorderWidth + prefs.gap
  1547.                     starty = d4                                    + prefs.gap
  1548.                     d1     = startx
  1549.                     d2     = starty
  1550.                     d3     = d1 + psx0
  1551.                     d4     = d2 + psy0
  1552.                 END
  1553.  
  1554.                 /*
  1555.                 ** 2. check if too far down -> next page
  1556.                 */
  1557.                 IF ((d4 - 1) > (pagesizey - prefs.bottomGap - prefs.pageBorderWidth - (prefs.lSize+1) - prefs.gap))
  1558.                 THEN DO
  1559.                     startx  = prefs.leftGap + prefs.pageBorderWidth + prefs.gap
  1560.                     starty  = prefs.topGap  + prefs.pageBorderWidth + prefs.gap
  1561.                     lastpic = 1       /* last picture already placed! print or flip page and go on... */
  1562.                     'DELETEOBJECT OBJECTID 'picid' WINDOW "'oldwinname'"'
  1563.                     RETURN 1
  1564.                 END
  1565.                 startx = d1 + psx0 + prefs.gap
  1566.             END
  1567.             ELSE DO
  1568.                 /*
  1569.                 ** vertical mode is on:
  1570.                 ** 1. check if too far down -> next column
  1571.                 */
  1572.                 IF ((d4 - 1) > (pagesizey - prefs.bottomGap - prefs.pageBorderWidth - (prefs.lSize+1) - prefs.gap))
  1573.                 THEN DO
  1574.                     startx = d3                                    + prefs.gap
  1575.                     starty = prefs.topgap  + prefs.pageBorderWidth + prefs.gap
  1576.                     d1     = startx
  1577.                     d2     = starty
  1578.                     d3     = d1 + psx0
  1579.                     d4     = d2 + psy0
  1580.                 END
  1581.  
  1582.                 /*
  1583.                 ** 2. check if too far right -> next page
  1584.                 */
  1585.                 IF ((d3 - 1) > (pagesizex - prefs.rightGap - prefs.pageBorderWidth - prefs.gap))
  1586.                 THEN DO
  1587.                     startx  = prefs.leftgap + prefs.pageBorderWidth + prefs.gap
  1588.                     starty  = prefs.topgap  + prefs.pageBorderWidth + prefs.gap
  1589.                     lastpic = 1       /* last picture already placed! print or flip page and go on... */
  1590.                     'DELETEOBJECT OBJECTID 'picid' WINDOW "'oldwinname'"'
  1591.                     RETURN 1
  1592.                 END
  1593.                 starty = d2 + psy0 + prefs.gap
  1594.             END
  1595.  
  1596.             /* calculate the new position and dimensions of the sample */
  1597.             newl = d1 + centerdeltax
  1598.             newt = d2 + centerdeltay
  1599.             newr = newl + newpwidth
  1600.             newb = newt + newpheight
  1601.             SELECT
  1602.                 WHEN (pictype = 1)
  1603.                 THEN 'EDITPICTURE POSITION 'newl newt newr newb' STORED EXTERNAL FPO '|| FPO_String ||' OBJECTID 'picid
  1604.                 WHEN (pictype = 2)
  1605.                 THEN IF (document3 = 1)
  1606.                      THEN 'EDITDRAWING POSITION 'newl newt newr newb' OBJECTID 'picid
  1607.                      ELSE 'EDITDRAWING POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
  1608.                 OTHERWISE 'EDITEPS POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
  1609.             END
  1610.         END
  1611.         ELSE DO
  1612.             gsf = pwidth / pheight
  1613.             IF (gsf > psf1) THEN factor = psx1 / pwidth
  1614.             ELSE                 factor = psy1 / pheight
  1615.  
  1616.             IF (prefs.PV_upscale)
  1617.             THEN IF (factor > 1) THEN factor = 1
  1618.  
  1619.             newpwidth  = factor * pwidth
  1620.             newpheight = factor * pheight
  1621.  
  1622.             d3 = d1 + newpwidth  + 2*(prefs.sampleBorderWidth + prefs.thumbSpace)
  1623.             d4 = d2 + newpheight + 2*(prefs.sampleBorderWidth + prefs.thumbSpace) + prefs.txtLines*(prefs.txtSize+1)
  1624.  
  1625.  
  1626.             IF (prefs.PV_vertical = 0)
  1627.             THEN DO
  1628.                 /*
  1629.                 ** vertical mode is off:
  1630.                 ** 1. check if too far right -> next row
  1631.                 */
  1632.                 IF ((d3 - 1) > (pagesizex - prefs.rightGap - prefs.pageBorderWidth - prefs.gap))
  1633.                 THEN DO
  1634.                     startx = prefs.leftGap + prefs.pageBorderWidth + prefs.gap
  1635.                     starty = d2 + maxheight + 2*(prefs.sampleBorderWidth + prefs.thumbSpace) + prefs.txtLines*(prefs.txtSize + 1) + prefs.gap
  1636.                     d1 = startx
  1637.                     d2 = starty
  1638.                     d3 = d1 + newpwidth + 2*(prefs.sampleBorderWidth + prefs.thumbSpace)
  1639.                     d4 = d2 + newpheight + 2*(prefs.sampleBorderWidth + prefs.thumbSpace) + prefs.txtLines*(prefs.txtSize+1)
  1640.                     IF ((d3 - 1) > (pagesizex - prefs.rightGap - prefs.pageBorderWidth - prefs.gap))
  1641.                     THEN DO
  1642.                         IF (prefs.errorSkip = 0)
  1643.                         THEN DO
  1644.                             res = SizeError()
  1645.                             IF (res = 2)
  1646.                             THEN DO
  1647.                                 prefs.errorSkip = 1
  1648.                             END
  1649.                         END
  1650.                         IF (prefs.errorSkip = 1) | (res = 1)
  1651.                         THEN DO
  1652.                             Call BusyText(2, "%c%bskipping current picture...%n\n%c%n")
  1653.                             Call BusyProgress(2, 100)
  1654.                             Call DumpText('('||pNum||') '||name||' -> ...skipped')
  1655.                             'DELETEOBJECT OBJECTID 'picid
  1656.                             startx = oldStartx
  1657.                             starty = oldStarty
  1658.                             Return 0
  1659.                         END
  1660.                     END
  1661.                     maxheight = 0
  1662.                     maxwidth  = 0
  1663.                 END
  1664.  
  1665.                 /*
  1666.                 ** 2. check if too far down -> next page
  1667.                 */
  1668.                 IF ((d4 - 1) > (pagesizey - prefs.bottomGap - prefs.pageBorderWidth - (prefs.lSize+1) - prefs.gap))
  1669.                 THEN DO
  1670.                     startx = prefs.leftGap + prefs.pageBorderWidth + prefs.gap
  1671.                     starty = prefs.topGap + prefs.pageBorderWidth + prefs.gap
  1672.                     IF ((starty + newpheight + 2*(prefs.sampleBorderWidth + prefs.thumbSpace) + prefs.txtLines*(prefs.txtSize+1)) > (pagesizey - prefs.bottomGap - prefs.pageBorderWidth - (prefs.lSize+1) - prefs.gap))
  1673.                     THEN DO
  1674.                         IF (prefs.errorSkip = 0)
  1675.                         THEN DO
  1676.                             res = SizeError()
  1677.                             IF (res = 2)
  1678.                             THEN DO
  1679.                                 prefs.errorSkip = 1
  1680.                             END
  1681.                         END
  1682.                         IF (prefs.errorSkip = 1) | (res = 1)
  1683.                         THEN DO
  1684.                             Call BusyText(2, "%c%bskipping current picture...%n\n%c%n")
  1685.                             Call BusyProgress(2, 100)
  1686.                             Call DumpText('('||pNum||') '||name||' -> ...skipped')
  1687.                             'DELETEOBJECT OBJECTID 'picid
  1688.                             startx = oldStartx
  1689.                             starty = oldStarty
  1690.                             Return 0
  1691.                         END
  1692.                     END
  1693.                     maxheight = 0
  1694.                     maxwidth  = 0
  1695.                     lastpic = 1       /* last picture already placed! print or flip page and go on... */
  1696.                     'DELETEOBJECT OBJECTID 'picid
  1697.                     RETURN 1
  1698.                 END
  1699.                 startx = d3 + prefs.gap
  1700.             END
  1701.             ELSE DO
  1702.                 /*
  1703.                 ** vertical mode is on:
  1704.                 ** 1. check if too far down -> next column
  1705.                 */
  1706.  
  1707.                 IF ((d4 - 1) > (pagesizey - prefs.bottomGap - prefs.pageBorderWidth - (prefs.lSize+1) - prefs.gap))
  1708.                 THEN DO
  1709.                     startx = d1 + maxwidth + 2*(prefs.sampleBorderWidth + prefs.thumbSpace) + prefs.gap
  1710.                     starty = prefs.topGap + prefs.pageBorderWidth + prefs.gap
  1711.                     d1 = startx
  1712.                     d2 = starty
  1713.                     d3 = d1 + newpwidth  + 2*(prefs.sampleBorderWidth + prefs.thumbSpace)
  1714.                     d4 = d2 + newpheight + 2*(prefs.sampleBorderWidth + prefs.thumbSpace) + prefs.txtLines*(prefs.txtSize+1)
  1715.                     IF ((d4 - 1) > (pagesizey - prefs.bottomGap - prefs.pageBorderWidth - (prefs.lSize+1) - prefs.gap))
  1716.                     THEN DO
  1717.                         IF (prefs.errorSkip = 0)
  1718.                         THEN DO
  1719.                             res = SizeError()
  1720.                             IF (res = 2)
  1721.                             THEN DO
  1722.                                 prefs.errorSkip = 1
  1723.                             END
  1724.                         END
  1725.                         IF (prefs.errorSkip = 1) | (res = 1)
  1726.                         THEN DO
  1727.                             Call BusyText(2, "%c%bskipping current picture...%n\n%c%n")
  1728.                             Call BusyProgress(2, 100)
  1729.                             Call DumpText('('||pNum||') '||name||' -> ...skipped')
  1730.                             'DELETEOBJECT OBJECTID 'picid
  1731.                             startx = oldStartx
  1732.                             starty = oldStarty
  1733.                             Return 0
  1734.                         END
  1735.                     END
  1736.                     maxheight = 0
  1737.                     maxwidth  = 0
  1738.                 END
  1739.  
  1740.                 /*
  1741.                 ** 2. check if too far right -> next page
  1742.                 */
  1743.                 IF ((d3 - 1) > (pagesizex - prefs.rightGap - prefs.pageBorderWidth - prefs.gap))
  1744.                 THEN DO
  1745.                     startx = prefs.leftGap + prefs.pageBorderWidth + prefs.gap
  1746.                     starty = prefs.topGap  + prefs.pageBorderWidth + prefs.gap
  1747.                     IF ((startx + newpwidth  + 2*(prefs.sampleBorderWidth + prefs.thumbSpace)) > (pagesizex - prefs.rightGap - prefs.pageBorderWidth - prefs.gap))
  1748.                     THEN DO
  1749.                         IF (prefs.errorSkip = 0)
  1750.                         THEN DO
  1751.                             res = SizeError()
  1752.                             IF (res = 2)
  1753.                             THEN DO
  1754.                                 prefs.errorSkip = 1
  1755.                             END
  1756.                         END
  1757.                         IF (prefs.errorSkip = 1) | (res = 1)
  1758.                         THEN DO
  1759.                             Call BusyText(2, "%c%bskipping current picture...%n\n%c%n")
  1760.                             Call BusyProgress(2, 100)
  1761.                             Call DumpText('('||pNum||') '||name||' -> ...skipped')
  1762.                             'DELETEOBJECT OBJECTID 'picid
  1763.                             startx = oldStartx
  1764.                             starty = oldStarty
  1765.                             Return 0
  1766.                         END
  1767.                     END
  1768.                     maxheight = 0
  1769.                     maxwidth  = 0
  1770.                     lastpic = 1       /* last picture already placed! print or flip page and go on... */
  1771.                     'DELETEOBJECT OBJECTID 'picid
  1772.                     RETURN 1
  1773.                 END
  1774.                 starty = d4 + prefs.gap
  1775.             END
  1776.             /*
  1777.             ** remember maximum width and height of the sample
  1778.             */
  1779.             IF (newpheight > maxheight)
  1780.             THEN maxheight = newpheight
  1781.  
  1782.             IF (newpwidth > maxwidth)
  1783.             THEN maxwidth = newpwidth
  1784.  
  1785.             newl = d1 + (prefs.sampleBorderWidth + prefs.thumbSpace)
  1786.             newt = d2 + (prefs.sampleBorderWidth + prefs.thumbSpace)
  1787.             newr = newl + newpwidth
  1788.             newb = newt + newpheight
  1789.  
  1790.             SELECT
  1791.                 WHEN (pictype = 1)
  1792.                     THEN 'EDITPICTURE POSITION 'newl newt newr newb' STORED EXTERNAL FPO '|| FPO_String ||' OBJECTID 'picid
  1793.                 WHEN (pictype = 2)
  1794.                     THEN IF (document3 = 1)
  1795.                         THEN 'EDITDRAWING POSITION 'newl newt newr newb' OBJECTID 'picid
  1796.                         ELSE 'EDITDRAWING POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
  1797.                 OTHERWISE
  1798.                     'EDITEPS POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
  1799.             END
  1800.         END
  1801.  
  1802.         IF (prefs.txtSize > 0)
  1803.         THEN DO
  1804.             d41 = d4 - prefs.txtLines*(prefs.txtSize + 1)
  1805.             'DRAWTEXTOBJ 'd1 d41' INFRONT WINDOW "'oldwinname'"'
  1806.             txtid = RESULT
  1807.             'SELECTTEXT INOBJECT '|| txtid ||' REPLACE WINDOW "'oldwinname'"'
  1808.  
  1809.             'BEGINCOMMANDCAPTURE'
  1810.              'SETTRACKTABLE NONE'
  1811.              'SETLEADING RELATIVE 100%'
  1812.              'SETTYPESIZE 'prefs.txtSize
  1813.              'SETPARAGRAPHSTYLE "PicName"'
  1814.             'ENDCOMMANDCAPTURE'
  1815.  
  1816.             /*
  1817.             ** prepare the thumbnail text
  1818.             */
  1819.             factorText  = Trunc(factor * 100,2)/1 || '%'
  1820.             nameReverse = Reverse(name)
  1821.             pos         = Pos('/', nameReverse)
  1822.             IF (pos = 0)
  1823.             THEN pos = Pos(':', nameReverse)
  1824.             namePic          = Right(name, pos-1)
  1825.             namePathComplete = Left(name, Length(name)-(pos-1))
  1826.             IF (Index(namePathComplete, prefs.PV_dir) > 0)
  1827.             THEN DO
  1828.                 namePathRelative = DelStr(namePathComplete, 1, Length(prefs.PV_dir))
  1829.                 IF (namePathRelative = '')
  1830.                 THEN namePathRelative = ':'
  1831.             END
  1832.  
  1833.             /*
  1834.             ** abbreviations for the text
  1835.             ** %PICTURENAME / %PN : pure name
  1836.             ** %PICTUREPATHFULL / %PPF : path full
  1837.             ** %PICTUREPATHRELATIVE / %PPR : path relative
  1838.             ** %TYPE : picture type
  1839.             ** %FACTOR : scale factor
  1840.             */
  1841.  
  1842.             DO tk = 0 TO (prefs.thumbText.num - 1)
  1843.                 infoText.tk = prefs.thumbText.tk
  1844.                 /* Picture Name */
  1845.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%PICTURENAME', namePic)
  1846.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%PN', namePic)
  1847.                 /* Picture Path Full */
  1848.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%PICTUREPATHFULL', namePathComplete)
  1849.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%PPF', namePathComplete)
  1850.                 /* Picture Path Relative */
  1851.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%PICTUREPATHRELATIVE', namePathRelative)
  1852.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%PPR', namePathRelative)
  1853.                 /* FileType */
  1854.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%TYPE', picTypeText)
  1855.                 /* scale factor */
  1856.                 infoText.tk = ReplaceItemInText(infoText.tk, '\%SCALE', factorText)
  1857.             END
  1858.  
  1859.             d41 = d4 - prefs.txtLines*(prefs.txtSize + 1)
  1860.             DO tk = 0 TO (prefs.thumbText.num - 1)
  1861.                 'DRAWTEXTOBJ 'd1 d41' INFRONT WINDOW "'oldwinname'"'
  1862.                 txtid = RESULT
  1863.                 'SELECTTEXT INOBJECT '|| txtid ||' REPLACE WINDOW "'oldwinname'"'
  1864.  
  1865.                 'BEGINCOMMANDCAPTURE'
  1866.                  'SETTRACKTABLE NONE'
  1867.                  'SETLEADING RELATIVE 100%'
  1868.                  'SETTYPESIZE 'prefs.txtSize
  1869.                  'SETPARAGRAPHSTYLE "PicName"'
  1870.                 'ENDCOMMANDCAPTURE'
  1871.  
  1872.                 'INSERT "'|| infoText.tk ||'"'
  1873.                 'GETTEXTOBJ POSITION txtpos OBJECTID 'txtid
  1874.                 txtp2.left   = txtpos.left
  1875.                 txtp2.top    = txtpos.top
  1876.                 txtp2.bottom = txtpos.bottom
  1877.                 txtp2.right  = txtpos.right
  1878.  
  1879.                 txtwidth = txtp2.right - txtp2.left
  1880.                 IF (txtwidth > (d3-d1))
  1881.                 THEN 'EDITTEXTOBJ POSITION 'txtp2.left txtp2.top d3 txtp2.bottom' OBJECTID 'txtid
  1882.  
  1883.                 d41 = d41 + prefs.txtSize + 1
  1884.             END
  1885.         END
  1886.  
  1887.         d11 = d1 + prefs.sampleBorderWidth/2
  1888.         d21 = d2 + prefs.sampleBorderWidth/2
  1889.         d31 = d3 - prefs.sampleBorderWidth/2
  1890.         d41 = d4 - prefs.txtLines*(prefs.txtSize+1) - prefs.sampleBorderWidth/2
  1891.  
  1892.         'DRAWBOX 'd11 d21 d31 d41' WINDOW "'oldwinname'"'
  1893.         dummy = RESULT
  1894.         'SETSTROKEWEIGHT 'prefs.sampleBorderWidth' OBJECTID 'dummy
  1895.         'SETSTROKEJOIN BEVEL OBJECTID 'dummy
  1896.  
  1897.         nppp = nppp + 1
  1898.         Call DumpText('('||pNum||') '||name||' -> ...created')
  1899.     END
  1900.     ELSE DO
  1901.         Call BusyText(2, "%c%bscanning directories...%n\n%c%n")
  1902.         Call BusyProgress(2, 30)
  1903.         Call DumpText('('||pNum||') '||name||' -> ...NOT created')
  1904.     END
  1905. RETURN 0
  1906. /* /// */
  1907. /* /// PictureCatalog()
  1908. */
  1909. PictureCatalog:
  1910.  
  1911.     ADDRESS 'PAGESTREAM'
  1912.  
  1913.     /*
  1914.     ** get default measurement system and switch to points
  1915.     */
  1916.  
  1917.     defmeasure = GetDefaultMeasurementSystem()
  1918.  
  1919.     /*
  1920.     ** get master page dimensions
  1921.     */
  1922.  
  1923.     'GETDIMENSIONS dim MASTERPAGE "'mname'" WINDOW "'oldwinname'"'
  1924.     IF (dim.orientation = 'PORTRAIT')
  1925.     THEN DO
  1926.         rpagesizex = dim.width
  1927.         rpagesizey = dim.height
  1928.     END
  1929.     ELSE DO
  1930.         rpagesizex = dim.height
  1931.         rpagesizey = dim.width
  1932.     END
  1933.  
  1934.     /*
  1935.     ** convert prefs to points measurement
  1936.     */
  1937.  
  1938.     Call ConvertTextToMultipleLines(x2c(prefs.PV_thumbText))
  1939.     prefs.thumbText.num = _dest.num
  1940.     DO k = 0 TO (_dest.num - 1)
  1941.         prefs.thumbText.k = _dest.k
  1942.     END
  1943.  
  1944.     pagesizex = rpagesizex
  1945.     pagesizey = rpagesizey
  1946.  
  1947.     prefs.leftGap        = p2d(prefs.PV_left,    const.measure)
  1948.     prefs.rightGap       = p2d(prefs.PV_right,      const.measure)
  1949.     prefs.topGap         = p2d(prefs.PV_top,        const.measure)
  1950.     prefs.bottomGap         = p2d(prefs.PV_bottom,     const.measure)
  1951.     prefs.pageBorderWidth   = p2d(prefs.PV_pbw,        const.measure)
  1952.     prefs.lSize          = p2d(prefs.PV_lSize,      const.measure)
  1953.     prefs.thumbSpace     = p2d(prefs.PV_thumbSpace,  const.measure)
  1954.     prefs.gap            = p2d(prefs.PV_gap,        const.measure)
  1955.     prefs.sampleBorderWidth = p2d(prefs.PV_sbw,        const.measure)
  1956.     prefs.txtSize        = p2d(prefs.PV_font,    const.measure)
  1957.     numx0 = prefs.PV_x_num
  1958.     numy0 = prefs.PV_y_num
  1959.     /*
  1960.     ** calculate start position for first thumbnail
  1961.     */
  1962.     startx = prefs.leftGap + prefs.pageBorderWidth + prefs.gap
  1963.     starty = prefs.topGap  + prefs.pageBorderWidth + prefs.gap
  1964.  
  1965.     /*
  1966.     ** calculate size for one thumbnail if horizontal and vertical
  1967.     ** numbers are specified
  1968.     */
  1969.     prefs.txtLines = prefs.thumbText.num
  1970.     psx0 = (pagesizeX - prefs.leftGap - prefs.rightGap - 2*prefs.pageBorderWidth - (numx0 + 1)*prefs.gap) / numx0
  1971.     psy0 = (pagesizeY - prefs.topGap - prefs.bottomGap - (prefs.lSize + 1) - 2*prefs.pageBorderWidth - (numy0 + 1)*prefs.gap) / numy0
  1972.     psy0nt = psy0 - prefs.txtLines*(prefs.txtSize+1)
  1973.  
  1974.     psf0 = (psx0 - 2*(prefs.sampleBorderWidth + 1)) / (psy0nt - 2*(prefs.sampleBorderWidth + 1))
  1975.     anzp = numx0 * numy0
  1976.  
  1977.     /*
  1978.     ** calculate size for one thumbnail if horizontal and vertical
  1979.     ** sizes for one thumbnail are specified
  1980.     */
  1981.  
  1982.     psx1 = p2d(prefs.PV_x_size, const.measure)
  1983.     psy1 = p2d(prefs.PV_y_size, const.measure)
  1984.     psf1 = psx1 / psy1
  1985.  
  1986.     oldfilename = 'NONE'
  1987.  
  1988.     commands = 'C:Copy >NIL: "'prefs.PV_dump'PicCatalog.dumpfile" "'prefs.PV_dump'PicCatalog.dumpfileOLD" QUIET'
  1989.     ADDRESS COMMAND commands
  1990.     commands = prefs.PV_dump'PicCatalog.dumpfile'
  1991.     IF (Open('dump', commands, 'W') = 1)
  1992.     THEN DO
  1993.         wl = WriteLN('dump','DUMPFILE for '|| pgsName pgsVersion ||' - '|| pgsCopy ||'')
  1994.         cl = Close('dump')
  1995.     END
  1996.  
  1997.     pNum = 0
  1998.     nppp = 0
  1999.     maxheight = 0
  2000.     maxwidth  = 0
  2001.  
  2002.     /*
  2003.     ** draw the border on master page
  2004.     */
  2005.  
  2006.     CALL DrawPageBorder
  2007.  
  2008.     'REFRESH WAIT'
  2009.  
  2010.     /*
  2011.     ** work directory
  2012.     */
  2013.  
  2014.     dummy = RekDir(prefs.PV_dir)
  2015.  
  2016.     IF (nppp=0) THEN 'DELETEPAGE'
  2017.     IF ((nppp > 0) & (prefs.PV_action = 1))
  2018.     THEN DO    /* ready but not yet printed */
  2019.         Call BusyText(2, "%c%brefreshing display%n\n%c...%n")
  2020.         Call BusyProgress(2, 50)
  2021.         'REFRESH CONTINUE'
  2022.         'REFRESHWINDOW WINDOW "'oldWinName'"'
  2023.  
  2024.         CALL PrintPage
  2025.     END
  2026.  
  2027.     IF ((nppp > 0) & (prefs.PV_action = 2))
  2028.     THEN DO    /* ready but not yet saved */
  2029.         Call BusyText(2, "%c%brefreshing display%n\n%c...%n")
  2030.         Call BusyProgress(2, 50)
  2031.         'REFRESH CONTINUE'
  2032.         'REFRESHWINDOW WINDOW "'oldWinName'"'
  2033.         CALL SaveDocument
  2034.     END
  2035.  
  2036.     CALL CLEANUP
  2037. RETURN
  2038. /* /// */
  2039. /* /// PrefsWindowGet()
  2040. */
  2041. PrefsWindowGet:
  2042.  
  2043.     Call GetAttr("g_top",        "CONTENTS", "prefs.PV_top")
  2044.         Call SetCorrectMSys('prefs.PV_top')
  2045.     Call GetAttr("g_left",       "CONTENTS", "prefs.PV_left")
  2046.         Call SetCorrectMSys('prefs.PV_left')
  2047.     Call GetAttr("g_bottom",     "CONTENTS", "prefs.PV_bottom")
  2048.         Call SetCorrectMSys('prefs.PV_bottom')
  2049.     Call GetAttr("g_right",      "CONTENTS", "prefs.PV_right")
  2050.         Call SetCorrectMSys('prefs.PV_right')
  2051.     Call GetAttr("g_pbw",        "CONTENTS", "prefs.PV_pbw")
  2052.         Call SetCorrectMSys('prefs.PV_pbw')
  2053.     Call GetAttr("g_lsize",      "CONTENTS", "prefs.PV_lsize")
  2054.         Call SetCorrectMSys('prefs.PV_lsize')
  2055.  
  2056.     Call GetAttr("g_size",       "ACTIVE",   "prefs.PV_size")
  2057.     Call GetAttr("g_x_num",      "VALUE",    "prefs.PV_x_num")
  2058.     Call GetAttr("g_y_num",      "VALUE",    "prefs.PV_y_num")
  2059.     Call GetAttr("g_x_size",     "CONTENTS", "prefs.PV_x_size")
  2060.         Call SetCorrectMSys('prefs.PV_x_size')
  2061.     Call GetAttr("g_y_size",     "CONTENTS", "prefs.PV_y_size")
  2062.         Call SetCorrectMSys('prefs.PV_y_size')
  2063.     Call GetAttr("g_upscale",    "SELECTED", "prefs.PV_upscale")
  2064.     Call GetAttr("g_vertical",   "SELECTED", "prefs.PV_vertical")
  2065.     Call GetAttr("g_sbw",        "CONTENTS", "prefs.PV_sbw")
  2066.         Call SetCorrectMSys('prefs.PV_sbw')
  2067.     Call GetAttr("g_thumbSpace", "CONTENTS", "prefs.PV_thumbSpace")
  2068.         Call SetCorrectMSys('prefs.PV_thumbSpace')
  2069.     Call GetAttr("g_gap",        "CONTENTS", "prefs.PV_gap")
  2070.         Call SetCorrectMSys('prefs.PV_gap')
  2071.     Call GetAttr("g_font",       "CONTENTS", "prefs.PV_font")
  2072.         Call SetCorrectMSys('prefs.PV_font')
  2073.     Call GetAttr("g_thumbtext",  "CONTENTS", "rawText")
  2074.         prefs.PV_thumbText = ConvertText2hex(rawText)
  2075.     Call GetAttr("g_fpo",        "ACTIVE",   "prefs.PV_fpo")
  2076.     Call GetAttr("g_fpoCustom",  "CONTENTS", "prefs.PV_fpoCustom")
  2077.  
  2078.     Call GetAttr("g_dir",         "CONTENTS", "prefs.PV_dir")
  2079.     Call GetAttr("g_rec",         "SELECTED", "prefs.PV_rec")
  2080.     Call GetAttr("g_dirPattern",  "CONTENTS", "prefs.PV_dirPattern")
  2081.     Call GetAttr("g_filePattern", "CONTENTS", "prefs.PV_filePattern")
  2082.     Call GetAttr("g_dump",        "CONTENTS", "prefs.PV_dump")
  2083.     Call GetAttr("g_skip",        "SELECTED", "prefs.PV_skip")
  2084.     Call GetAttr("g_sdir",        "CONTENTS", "prefs.PV_sdir")
  2085.  
  2086.     Call GetAttr("g_method",     "ACTIVE",   "prefs.PV_method")
  2087.     Call GetAttr("g_scale",      "ACTIVE",   "prefs.PV_scale")
  2088.  
  2089.     Call GetAttr("g_action",     "ACTIVE",   "prefs.PV_action")
  2090.  
  2091.     /*
  2092.     ** also get the selected objects
  2093.     */
  2094.     Call DoMethod("G_SELECT", "GETENTRIES", rFormats)
  2095.     prefs.PV_formats = ''
  2096.     IF (rFormats.num >= 0)
  2097.     THEN DO
  2098.         prefs.PV_formats = rFormats.0
  2099.         DO k=1 to (rFormats.num)
  2100.             prefs.PV_formats = prefs.PV_formats' 'rFormats.k
  2101.         END
  2102.     END
  2103.  
  2104. Return
  2105. /* /// */
  2106. /* /// PrefsWindowSet()
  2107. */
  2108. PrefsWindowSet:
  2109.     Call Set("g_top",        "CONTENTS", prefs.PV_top)
  2110.     Call Set("g_left",       "CONTENTS", prefs.PV_left)
  2111.     Call Set("g_bottom",     "CONTENTS", prefs.PV_bottom)
  2112.     Call Set("g_right",      "CONTENTS", prefs.PV_right)
  2113.     Call Set("g_pbw",        "CONTENTS", prefs.PV_pbw)
  2114.     Call Set("g_lsize",      "CONTENTS", prefs.PV_lsize)
  2115.  
  2116.     Call Set("g_size",       "ACTIVE",   prefs.PV_size)
  2117.     Call Set("g_x_num",      "VALUE",    prefs.PV_x_num)
  2118.     Call Set("g_y_num",      "VALUE",    prefs.PV_y_num)
  2119.     Call Set("g_x_size",     "CONTENTS", prefs.PV_x_size)
  2120.     Call Set("g_y_size",     "CONTENTS", prefs.PV_y_size)
  2121.     Call Set("g_upscale",    "SELECTED", prefs.PV_upscale)
  2122.     Call Set("g_vertical",   "SELECTED", prefs.PV_vertical)
  2123.     Call Set("g_fpo",        "ACTIVE",   prefs.PV_fpo)
  2124.     Call Set("g_fpoCustom",  "CONTENTS", prefs.PV_fpoCustom)
  2125.     Call Set("g_sbw",        "CONTENTS", prefs.PV_sbw)
  2126.     Call Set("g_thumbSpace", "CONTENTS", prefs.PV_thumbSpace)
  2127.     Call Set("g_gap",        "CONTENTS", prefs.PV_gap)
  2128.     Call Set("g_font",       "CONTENTS", prefs.PV_font)
  2129.     Call Set("g_thumbtext",  "CONTENTS", parseText(x2c(prefs.PV_thumbText)))
  2130.  
  2131.     Call Set("g_dir",         "CONTENTS", prefs.PV_dir)
  2132.     Call Set("g_rec",         "SELECTED", prefs.PV_rec)
  2133.     Call Set("g_dirPattern",  "CONTENTS", prefs.PV_dirPattern)
  2134.     Call Set("g_filePattern", "CONTENTS", prefs.PV_filePattern)
  2135.     Call Set("g_dump",        "CONTENTS", prefs.PV_dump)
  2136.     Call Set("g_skip",        "SELECTED", prefs.PV_skip)
  2137.     Call Set("g_sdir",        "CONTENTS", prefs.PV_sdir)
  2138.  
  2139.     Call Set("g_method",      "ACTIVE",   prefs.PV_method)
  2140.     Call Set("g_scale",       "ACTIVE",   prefs.PV_scale)
  2141.  
  2142.     Call Set("g_action",      "ACTIVE",   prefs.PV_action)
  2143.  
  2144.     Call FormatListsInitialize()
  2145.  
  2146. Return
  2147. /* /// */
  2148. /* /// PrintPage()
  2149. */
  2150. PrintPage:
  2151.     output.0 = 'GRAYSCALE'
  2152.     output.1 = 'COLOR'
  2153.  
  2154.     CALL DumpText('----- printing page -----')
  2155.  
  2156.     Call BusyText(2, "%c%bprinting page%n\n%c"|| pagenumber ||"%n")
  2157.     Call BusyProgress(2, 100)
  2158.  
  2159.     prm = prefs.PV_method
  2160.  
  2161.     IF (prefs.PV_scale = 0)
  2162.     THEN DO
  2163.       'PRINTDOCUMENT PAGE "" OUTPUT '|| output.prm ||' SCALE "ACTUAL"'
  2164.     END
  2165.     IF (prefs.PV_scale = 1)
  2166.     THEN DO
  2167.       'PRINTDOCUMENT PAGE "" OUTPUT '|| output.prm ||' SCALE "FULLPAGE"'
  2168.     END
  2169.  
  2170.     Call BusyText(2, "%c%bdeleting page%n\n%c...%n")
  2171.     Call BusyProgress(2, 50)
  2172.     'SELECTOBJECT ALL WINDOW "'oldwinname'"'
  2173.     'DELETEOBJECT WINDOW "'oldwinname'"'
  2174. RETURN
  2175. /* /// */
  2176. /* /// RekDir(dir)
  2177. */
  2178. RekDir:
  2179.    PROCEDURE EXPOSE prefs. const. oldfilepath oldwinname wpw wph pNum anzp pagesizex pagesizey psf0 psx0 psy0 psy0nt psf1 psx1 psy1 BusyReq defmeasure pcversion startx starty lastpic pageNumber nppp maxheight maxwidth
  2180.  
  2181.     PARSE ARG dir
  2182.  
  2183.     Call BusyText(2, "%c%bscanning...%n\n%c"|| dir ||"%n")
  2184.     Call BusyProgress(2, 100)
  2185.  
  2186.     /*
  2187.      * list all files in directory into a buffer file
  2188.      */
  2189.  
  2190.    say dir prefs.PV_filePattern
  2191.     ADDRESS COMMAND 'C:list DIR "'||dir||'" PAT "'prefs.PV_filePattern'" LFORMAT="%F%N" FILES >T:PicCatalogFilesUS.tmp'
  2192.  
  2193.     /*
  2194.      * sort the buffer file (if entries exist)
  2195.      */
  2196.  
  2197.     IF (GetLength('T:PicCatalogFilesUS.tmp') = 0)
  2198.     THEN ADDRESS COMMAND 'C:Copy T:PicCatalogFilesUS.tmp TO T:PicCatalogFilesS.tmp'
  2199.     ELSE DO
  2200.         ADDRESS COMMAND 'C:Sort FROM T:PicCatalogFilesUS.tmp TO T:PicCatalogFilesS.tmp'
  2201.         Call WorkFileList
  2202.     END
  2203.  
  2204.     ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalogFilesUS.tmp T:PicCatalogFilesS.tmp QUIET'
  2205.  
  2206.     /*
  2207.      * if recursive mode is on, list subdirectories
  2208.      */
  2209.  
  2210.     IF (prefs.PV_rec = 1)
  2211.     THEN DO
  2212.  
  2213.         /*
  2214.          * list subdirs into buffer and sort them
  2215.          */
  2216.  
  2217.         ADDRESS COMMAND 'C:List DIR "'|| dir ||'" PAT "'prefs.PV_dirPattern'" LFORMAT="%F%N" DIRS >T:PicCatalogDirsUS.tmp'
  2218.  
  2219.         IF (GetLength('T:PicCatalogDirsUS.tmp') = 0)
  2220.         THEN ADDRESS COMMAND 'C:Copy T:PicCatalogDirsUS.tmp TO T:PicCatalogDirsS.tmp'
  2221.         ELSE DO
  2222.  
  2223.             /*
  2224.              * if at least one entry is in buffer, work this directory
  2225.              */
  2226.  
  2227.             ADDRESS COMMAND 'C:Sort FROM T:PicCatalogDirsUS.tmp TO T:PicCatalogDirsS.tmp'
  2228.             Call WorkDirList
  2229.         END
  2230.  
  2231.         /*
  2232.          * delete remaining buffer directory file
  2233.          */
  2234.  
  2235.         ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalogDirsUS.tmp T:PicCatalogDirsS.tmp QUIET'
  2236.  
  2237.     END
  2238. RETURN 0
  2239. /* /// */
  2240. /* /// ReplaceItemInText(src, item, new)
  2241. */
  2242. ReplaceItemInText:
  2243.     PARSE ARG src,item,new
  2244.  
  2245.     /*
  2246.     ** prepare the thumbnail text
  2247.     */
  2248.  
  2249.     dest = src
  2250.     pos = Index(dest, item)
  2251.     IF (pos > 0)
  2252.     THEN DO
  2253.         dest = DelStr(dest, pos, Length(item))
  2254.         dest = Insert(new, dest, pos-1)
  2255.     END
  2256. Return dest
  2257. /* /// */
  2258. /* /// SaveDocument()
  2259. */
  2260. SaveDocument:
  2261.     Call BusyText(2, "%c%bsaving document%n\n%c"|| prefs.PV_sDir ||"%n")
  2262.     Call BusyProgress(2, 100)
  2263.  
  2264.     Call DumpText('----- saving document: "'prefs.PV_sDir'" -----')
  2265.     'SAVEDOCUMENT FILE "'prefs.PV_sDir'" FILTER IFFDOC STATUS FORCE'
  2266. RETURN
  2267. /* /// */
  2268. /* /// SavePrefs(fileName)
  2269. */
  2270. SavePrefs:
  2271.     /*
  2272.     ** save the preferences file
  2273.     ** -------------------------
  2274.     */
  2275.  
  2276.     PARSE ARG filename
  2277.     IF (fileName = "")
  2278.     THEN fileName = standardPrefs
  2279.  
  2280.     say 'saving 'fileName' ...'
  2281.  
  2282.     okOpen = Open('Prefs', fileName, 'W')
  2283.     IF (okOpen = 1)
  2284.     THEN DO
  2285. OPTIONS FAILAT 11
  2286.         Say 'writing prefs "'|| fileName ||'"...'
  2287.         WriteLN('Prefs', pgsName pgsVersion)
  2288.  
  2289.         Call WritePrefsNameValue('Prefs', 'prefs.PV_top')
  2290.         Call WritePrefsNameValue('Prefs', 'prefs.PV_left')
  2291.         Call WritePrefsNameValue('Prefs', 'prefs.PV_bottom')
  2292.         Call WritePrefsNameValue('Prefs', 'prefs.PV_right')
  2293.         Call WritePrefsNameValue('Prefs', 'prefs.PV_pbw')
  2294.         Call WritePrefsNameValue('Prefs', 'prefs.PV_lsize')
  2295.  
  2296.         Call WritePrefsNameValue('Prefs', 'prefs.PV_size')
  2297.         Call WritePrefsNameValue('Prefs', 'prefs.PV_x_num')
  2298.         Call WritePrefsNameValue('Prefs', 'prefs.PV_y_num')
  2299.         Call WritePrefsNameValue('Prefs', 'prefs.PV_x_size')
  2300.         Call WritePrefsNameValue('Prefs', 'prefs.PV_y_size')
  2301.         Call WritePrefsNameValue('Prefs', 'prefs.PV_upscale')
  2302.         Call WritePrefsNameValue('Prefs', 'prefs.PV_vertical')
  2303.         Call WritePrefsNameValue('Prefs', 'prefs.PV_fpo')
  2304.         Call WritePrefsNameValue('Prefs', 'prefs.PV_fpoCustom')
  2305.         Call WritePrefsNameValue('Prefs', 'prefs.PV_sbw')
  2306.         Call WritePrefsNameValue('Prefs', 'prefs.PV_thumbSpace')
  2307.         Call WritePrefsNameValue('Prefs', 'prefs.PV_gap')
  2308.         Call WritePrefsNameValue('Prefs', 'prefs.PV_font')
  2309.         Call WritePrefsNameValue('Prefs', 'prefs.PV_thumbText')
  2310.  
  2311.         Call WritePrefsNameValue('Prefs', 'prefs.PV_dir')
  2312.         Call WritePrefsNameValue('Prefs', 'prefs.PV_rec')
  2313.         Call WritePrefsNameValue('Prefs', 'prefs.PV_dirPattern')
  2314.         Call WritePrefsNameValue('Prefs', 'prefs.PV_filePattern')
  2315.         Call WritePrefsNameValue('Prefs', 'prefs.PV_dump')
  2316.         Call WritePrefsNameValue('Prefs', 'prefs.PV_skip')
  2317.         Call WritePrefsNameValue('Prefs', 'prefs.PV_sdir')
  2318.  
  2319.         Call WritePrefsNameValue('Prefs', 'prefs.PV_method')
  2320.         Call WritePrefsNameValue('Prefs', 'prefs.PV_scale')
  2321.  
  2322.         Call WritePrefsNameValue('Prefs', 'prefs.PV_action')
  2323.         Call WritePrefsNameValue('Prefs', 'prefs.PV_formats')
  2324.  
  2325.         WriteLN('Prefs', '/* END OF Prefsfile for '|| pgsName pgsVersion ||' ('|| pgsDate ||') */')
  2326. OPTIONS FAILAT 10
  2327.         Call Close('Prefs')
  2328.     END
  2329.     ELSE DO
  2330.         Say 'Error writing prefs file "'|| fileName ||'"'
  2331.         Call ShowRequester('ERROR writing prefs file '|| fileName, 'Damn!')
  2332.     END
  2333. RETURN
  2334. /* /// */
  2335. /* /// SavePrefsAs()
  2336. */
  2337. SavePrefsAs:
  2338.     /*
  2339.     ** Save Prefs with selectable name
  2340.     ** -------------------------------
  2341.     */
  2342.  
  2343.     prefName = GetFileName(currentPrefs, 'Save Preferences As...')
  2344.     IF (prefName ~= 0)
  2345.     THEN DO
  2346.         currentPrefs = prefName
  2347.         Call SavePrefs(currentPrefs)
  2348.     END
  2349. Return
  2350. /* /// */
  2351. /* /// SetCorrectMSys(vName)
  2352. */
  2353. SetCorrectMSys:
  2354.     PARSE ARG vName
  2355.  
  2356.     Interpret vName || ' = p2d('|| vName || ', mSys('|| vName ||')) || mSys('|| vName ||')'
  2357. Return
  2358. /* /// */
  2359. /* /// SetDefaultPrefs()
  2360. */
  2361. SetDefaultPrefs:
  2362.  
  2363.     /*
  2364.     ** defaults needed in the program
  2365.     */
  2366.  
  2367.     Progress                = 0
  2368.     currentPrefs            = standardPrefs
  2369.     const.measure            = 'pt'
  2370.     const.tf.0                = 'FALSE'
  2371.     const.tf.1                = 'TRUE'
  2372.     const.formats            = 'UNIVERSAL ARTEXPRESSIONEPS BMP EPS FREEHANDEPS GIF IFFDR2D IFFILBM IFFILUS ILLUSTRATOREPS JPEG PCX PICT TIFF PAGESTREAM3DOC PRODRAWCLIP'
  2373.     const.fpo.0                = 'DEFAULT'
  2374.     const.fpo.1                = 'FINE'
  2375.     const.fpo.2                = 'MEDIUM'
  2376.     const.fpo.3                = 'COARSE'
  2377.     const.fpo.4                = 'CUSTOM'
  2378.  
  2379.     prefs.PV_left            = '1cm'                      /* page left */
  2380.     prefs.PV_right            = '1cm'                      /* page top */
  2381.     prefs.PV_top            = '1cm'                      /* page top */
  2382.     prefs.PV_bottom            = '1cm'                      /* page bottom */
  2383.     prefs.PV_pbw            = '3pt'                      /* page border width */
  2384.     prefs.PV_lsize            = '12pt'                     /* page text size */
  2385.  
  2386.     prefs.PV_x_num            = '4'                        /* number of thumbnails X */
  2387.     prefs.PV_y_num            = '6'                        /* number of thumbnails Y */
  2388.     prefs.PV_x_size            = '200pt'                    /* size of one thumbnail X */
  2389.     prefs.PV_y_size            = '200pt'                    /* size of one thumbnail Y */
  2390.     prefs.PV_upscale        = '0'                        /* do not upscale pics */
  2391.     prefs.PV_vertical        = '0'                        /* no vertical mode */
  2392.     prefs.PV_fpo            = '0'                        /* FPU = DEFAULT */
  2393.     prefs.PV_fpoCustom        = '50'                            /* FPO Custom = 50dpi */
  2394.     prefs.PV_thumbSpace        = '2pt'                      /* Thumbnail space */
  2395.     prefs.PV_gap            = '5mm'                      /* gap between pictures */
  2396.     prefs.PV_sbw            = '2pt'                      /* sample border width */
  2397.     prefs.PV_font            = '8pt'                      /* font size for thumbnails */
  2398.     prefs.PV_size            = '8pt'                      /* size for the picnames */
  2399.     prefs.PV_thumbText        = ConvertText2hex("%PICTURENAME\n[%TYPE - %SCALE]") /* thumbnail text... */
  2400.  
  2401.     prefs.PV_dir            = 'Ram:'                     /* picture path */
  2402.     prefs.PV_rec            = '0'                        /* recursive */
  2403.     prefs.PV_dirPattern        = '#?'                       /* directory pattern */
  2404.     prefs.PV_filePattern    = '#?'                       /* file pattern */
  2405.     prefs.PV_sdir            = 'Ram:test.doc'             /* file for saving */
  2406.     prefs.PV_dump            = pgsInstallDir || '/'       /* dump file path */
  2407.     prefs.PV_skip            = '0'                        /* use skip file */
  2408.  
  2409.     prefs.PV_scale            = '0'                        /* print: scale to fit */
  2410.     prefs.PV_method            = '0'                        /* print: bw/color */
  2411.  
  2412.     prefs.PV_action         = '0'                        /* action (collect, save, print) */
  2413.     prefs.PV_formats        = 'UNIVERSAL IFFILBM'        /* active formats */
  2414.  
  2415.     prefs.errorSkip            = 0
  2416. Return
  2417. /* /// */
  2418. /* /// ShowRequester(question, knobs)
  2419. */
  2420. ShowRequester:
  2421.     /*
  2422.     ** Show requester with some gadgets
  2423.     ** --------------------------------
  2424.     */
  2425.     PARSE ARG question,knobs
  2426.     Say question
  2427.     reqData = EasyRequest(question, pgsNAme, knobs)
  2428.     say reqData
  2429. Return reqData
  2430. /* /// */
  2431. /* /// SizeError()
  2432. */
  2433. SizeError:
  2434.     res    = ShowRequester("Current picture is too big","skip|skip all|stop")
  2435.     IF (res = 0)
  2436.     THEN DO
  2437.         Call CLEANUP
  2438.         Exit
  2439.     END
  2440. Return res
  2441. /* /// */
  2442. /* /// WorkFileList()
  2443. */
  2444. WorkFileList:
  2445.    PROCEDURE EXPOSE prefs. const. oldfilepath oldwinname wpw wph pNum anzp pagesizex pagesizey psf0 psx0 psy0 psy0nt psf1 psx1 psy1 BusyReq defmeasure pcversion startx starty lastpic pageNumber nppp maxheight maxwidth
  2446.  
  2447.     fNum = 0
  2448.     IF (Open('flist','t:PicCatalogFilesS.tmp','R') ~= 1)
  2449.     THEN DO
  2450.         SAY 'Error when opening the File-TmpFiles!!!'
  2451.         EXIT
  2452.     END
  2453.  
  2454.     DO WHILE (eof('flist') = 0)
  2455.         named = readln('flist')
  2456.         IF (eof('flist') = 0)
  2457.         THEN DO
  2458.             name.fNum = named
  2459.             fNum = fNum + 1
  2460.         END
  2461.     END
  2462.     cl = Close('flist')
  2463.  
  2464.     DO k = 0 TO fNum-1
  2465.         IF (prefs.PV_skip = 1)
  2466.         THEN DO
  2467.             commands = 'C:Search >NIL: "'prefs.PV_dump'PicCatalog.dumpfileOLD" SEARCH "'name.k'"'
  2468.             ADDRESS COMMAND commands
  2469.             rcer = rc
  2470.             IF (rcer>0) THEN Call AddPicture(name.k)
  2471.             ELSE             Call DumpText('('||pNum||') '||name.k||' -> SKIPPED')
  2472.         END
  2473.         ELSE CALL AddPicture(name.k)
  2474.     END
  2475. RETURN
  2476. /* /// */
  2477. /* /// WorkDirList()
  2478. */
  2479. WorkDirList:
  2480.    PROCEDURE EXPOSE prefs. const. oldfilepath oldwinname wpw wph pNum anzp pagesizex pagesizey psf0 psx0 psy0 psy0nt psf1 psx1 psy1 BusyReq defmeasure pcversion startx starty lastpic pageNumber nppp maxheight maxwidth
  2481.  
  2482.     ad = 0
  2483.     IF (Open('dlist', 't:PicCatalogDirsS.tmp', 'R') ~= 1)
  2484.     THEN DO
  2485.         SAY 'Error while opening the DIR-TmpFiles!!!'
  2486.         EXIT
  2487.     END
  2488.  
  2489.     DO WHILE (eof('dlist') = 0)
  2490.         name = readln('dlist')
  2491.         IF (eof('dlist') = 0)
  2492.         THEN DO
  2493.             dirname.ad = name
  2494.             ad = ad + 1
  2495.         END
  2496.     END
  2497.     cl = Close('dlist')
  2498.  
  2499.     ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalogDirsUS.tmp T:PicCatalogDirsS.tmp QUIET'
  2500.  
  2501.     DO k = 0 TO (ad - 1)
  2502.         Call RekDir(dirname.k)
  2503.     END
  2504. Return
  2505. /* /// */
  2506. /* /// WritePrefsNameValue(file, name)
  2507. */
  2508. WritePrefsNameValue:
  2509.     /*
  2510.     ** write parameter with value in file
  2511.     ** ----------------------------------
  2512.     */
  2513.  
  2514.     PARSE ARG file,name
  2515.  
  2516.     Interpret "saveSTR = '"|| name ||" = ""'"|| name ||"'""'"
  2517.     WriteLN(file, saveSTR)
  2518. Return
  2519. /* /// */
  2520.  
  2521. /* /// ON SYNTAX
  2522. */
  2523. SYNTAX:
  2524.     f = rc
  2525.     str =               "*-------------------------------------------*"
  2526.     str = str || '|' || "* Syntax Error in line "|| sigl
  2527.     str = str || '|' || "* "|| f ||":" ErrorText(f)
  2528.     str = str || '|' || "*-------------------------------------------*"
  2529.     
  2530.     /*
  2531.     ** Unlock PageStream and QUIT
  2532.     */
  2533.     ADDRESS 'PAGESTREAM'
  2534.     'LOCKINTERFACE FALSE'
  2535.     'REFRESH ON'
  2536.     'REFRESHWINDOW WINDOW "'|| oldWinName ||'"'
  2537.     ''defmeasure''
  2538.  
  2539.     Call pgsRequester(str)
  2540.  
  2541.     IF (f = 15)
  2542.     THEN DO
  2543.         Call pgsRequester('You should consider to register rxMUI.|Looks like the trial time is over.')
  2544.     END
  2545.  
  2546. EXIT
  2547. /* /// */
  2548.  
  2549.